Information Technology Reference
In-Depth Information
CHAPTER 5
Branches
Whenever I'm asked about the pros of switching from an older version control systems
(VCS), such as CVS or Subversion, to git; I answer with this short statement: git branch-
ing model. Once you learn to use it you will ask yourself how on earth did I work
without it? Indeed, the way git handles branches sets it high above other (if not all) VCS
systems. As a matter of fact, I really believe that this single feature is sufficient reason to
switch to git.
What exactly is a branch? A branch is a line of development . This is a high-level
definition, unconcerned with implementation-specific aspects. Technically speaking, a
branch in git is a pointer to an arbitrary commit in the database . While it will take some
practice to use branches with confidence; you should start right from the first with the
most basic feature of branches. They are independent from each other. The way you
modify one branch does not influence the other branches. To preserve any point in the
project's history it is enough to create a branch. Git will never modify your branch, un-
less you explicitly ask it to do so.
This chapter will provide you with a strong grasp with most aspects of using
branches. We start with creating and switching branches in non-bare repositories. In par-
ticular, the discussion includes various aspects of the way git stores branches. This will
help you to understand why git branches are so efficient.
Next, we analyze branches in the context of cloning. It will lead us to the following
different types of branches:
• Remote branches (i.e. branches in remote repository)
• Local branches (i.e. branches in a repository you are currently working in)
• Ordinary local branches
Search WWH ::




Custom Search