Skip to content

Branches

Question

Explain branches in git or in general VSC.

Short interview answer

In Git, a branch is a lightweight movable reference to a commit. It represents an independent line of development that can later be merged, rebased, or discarded without changing another branch.

Detailed answer

Creating feature/invoice-export from main gives the feature a starting commit. New commits advance that branch while main can continue to advance separately. The branch name itself is not a copy of every file; it is a reference into the commit graph. When the feature is ready, the team can review its changes against main, resolve conflicts if both lines changed the same area, and integrate it according to its chosen workflow.

Glossary

  • VCS: Version control system.

Sources