Re: Recording the current branch on each commit?
From: Felipe Contreras <hidden>
Date: 2016-06-15 23:00:51
Jeremy Morton wrote:
On 27/04/2014 09:51, Robin Rosenberg wrote:quoted
quoted
Currently, git records a checksum, author, commit date/time, and commit message with every commit (as get be seen from 'git log'). I think it would be useful if, along with the Author and Date, git recorded the name of the current branch on each commit. The branch name can provide useful contextual information. For instance, let's say I'm developing a suite of games. If the commit message says "Added basic options dialog", it might be useful to see that the branch name is "pacman-minigame" indicating that the commit pertains to the options dialog in the Pacman minigame. Basically, I'm saying that well-named branches can and do carry useful contextual information that oughtn't to be thrown away. Currently, when you delete that branch, you lose the branch name altogether. So what do you think? Would it be good to have a patch to add this feature?Branch names are usually poorly named, so often you don't lose much. One waySpeak for yourself - I give my branches useful names. :-)
Me too.
I definitely feel that I am often losing useful contextual information by throwing away the branch name.
I don't.
quoted
some people to is to always merge with --no-ff, that way you see the branch name in the merge commit.But surely, it's recommended with Git that you try to avoid doing --no-ff merges to avoid commit noise?
Nope. Different people have different needs, there's no recommendation. If anything, the recommendation is to do a ff merge, because that's the default.
Also, it is a lot more hassle (and no doubt, CPU cycles) to track down where a branch was merged to try and figure out which branch name a commit pertained to, not to mention the fact that the commit could've been moved since. Nothing short of tagging the commit with the branch name when the commit is made will definitely record the branch name at the time of committing.
But why do you need that information? -- Felipe Contreras