[git-users] Do commits remember branch names?

2013-03-21 Thread Brian Jones
In out of the box git, do commits remember the name of the branch that 
created them? If so, what command can I use to see that information? My 
assumption is that commits do not record branch names but I want 
confirmation.

Brian

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] Do commits remember branch names?

2013-03-21 Thread Konstantin Khomoutov
On Thu, Mar 21, 2013 at 12:48:59PM -0700, Brian Jones wrote:

 In out of the box git, do commits remember the name of the branch that 
 created them? If so, what command can I use to see that information? My 
 assumption is that commits do not record branch names but I want 
 confirmation.

They do not.

Remember that Git was concieved with the Linux kernel in mind, and its
development uses a hierarchical approach where patches flow through many
staging trees so that names of actual branches in each of them have no
sense at all to the final result (look at the tree picture at [1] to get
better idea of that).

For small projects, the idea of keeping track of the originating branch
is not really so absurd, so some sort of a policy might be used for
this.  For instance, a prefix codifying a feature being developed might
be inserted in commit messages' headers.  Or a prepare-commit-msg hook
might be used to automatically insert some custom field in commit
messages.

Another approach (described in [2], for instance) is to never use
fast-forward merges of feature branches back into their originating
branches, and describe the feature in the integration merge commit.
This is not a solution to the problem as stated, but if you just want
better understanding of the project's history, this might be the way to
go.

1. http://lwn.net/Articles/318699/
2. http://nvie.com/posts/a-successful-git-branching-model/

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] Do commits remember branch names?

2013-03-21 Thread Dale R. Worley
 From: Brian Jones caneri...@gmail.com
 
 In out of the box git, do commits remember the name of the branch that 
 created them? If so, what command can I use to see that information? My 
 assumption is that commits do not record branch names but I want 
 confirmation.

You are correct, commits do not remember the name of the branch that
created them.  The problem is that there is a network (directed
acyclic graph) of commits.  Branches are actually pointers to specific
commits, the current head commit of the branch.  So after a while,
there may be no relationship between the branch that was checked out
in the working copy which created the commit and the commit itself.
Indeed, if you do a rebase on a development branch, most likely all
the commits that were created using that branch are no longer
ancestors of the head of that branch.

Dale

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.