Re: Branches & directories
- From
Michael Witten <mfwitten@gmail.com>
- Date
- Aug 21, 2011, 20:53 UTC
- Message-ID
- <CAMOZ1BvpnP_729YOHrrPW3B8wa5c4cLyD_qAQ5rTuy0JqNiiXg@mail.gmail.com>
- In-Reply-To
- <CAE1pOi2r9DT3Y-GxivTZRaNVi=qLOy5=QpQ-_YysOkgqy3iGRQ@mail.gmail.com>
On Sun, Aug 21, 2011 at 13:42 -0700, Hilco Wijbenga <hilco.wijbenga@gmail.com> wrote:
> Isn't a branch simply a way to track changes separately?
Well, what does that mean, really? You can certainly use branches to help you achieve that goal.
In git usage, a `branch' is just a human-readable name for any given commit object; it points to a commit object, and you can change to which commit it points. Furthermore, to help you work with commit lineages, some of the git machinery updates these branches (or `pointers', if you like) automatically (for instance, when you make a new commit object with `git commit', then the `current branch' is updated to point to the newly created commit object).
Of course, 2 different branches may be used to point to the same commit object.
You should really think of your repository as a giant web of commit objects (or, more technically, as a directed acyclic graph where each node is a commit object); a commit object can point 'backwards' towards its parent commit objects. A branch (like `master') just points to one of these commit objects at any given time (that is, a branch just gives a nice human-readable label by which to reference one of these commit objects at any given time).
See here too:
http://slashdot.org/comments.pl?sid=2350536&cid=36903136