- Branches are seperate, possibly diverging, histories of commits.
- Each branch points to the latest commit in its history.
- Branches allow for isolated development.
You might create a branch to
- isolate an experimental idea.
- separate the latest release from ongoing development.
- isolate changes to allow for more collaborative distributed development.
- share a new idea with other developers.
- Brings in the changes from another branch to the current one.
- Identifies conflicting changes, and allows the developer to resolve the conflict.
From man git-merge...
Assume the following history exists and the current branch is "master":
A---B---C topic
/
D---E---F---G master
Then "git merge topic" will replay the changes made on the topic branch since it diverged
from master (i.e., E) until its current commit (C) on top of master, and record the
result in a new commit along with the names of the two parent commits and a log message
from the user describing the changes.
A---B---C topic
/ \
D---E---F---G---H master