Branch names in commits

Hi guys,

Looking at the Cesium network, it shows branches exactly the way Git treats them, basically as pointers into head nodes of the graph:

https://github.com/AnalyticalGraphicsInc/cesium/network

Looking back farther in the past, the lines intertwine and mix a little, and it’s not always clear which changes ended up in which branches if they’re old. Also, often branches are merged into master and then the branch label is gone but an anonymous line of changes remains.

What do you guys think of the idea of starting each commit message with the name of the branch being committed to? Excluding auto-messages like merge of course, and excluding master.

So, if I make a change on the Sandcastle branch, the commit message will be something like “Sandcastle - Added cool new feature xyz.”

Actually I’ve been doing this for a while now on that branch, and I’m curious if it’s something the group thinks we should all adopt as part of coding standards, or if it’s not needed.

               --Ed.

I guess the one question I have is, why? What does this practice buy us? Why do we care which branch a change came from since it doesn’t matter once it gets merged into master? I mean if people want to do it, that’s fine; and I may even do it myself. But I don’t think we need to mandate it; it sounds like process for the sake of process.

I don’t have enough git experience to have a strong opinion here, but I’m all about less process. Also, how would this work for external forks? We can’t expect them to use such a convention. What is common in large codebases that use github?

Patrick

Most git projects use commit messages without the name of the branch,
although they sometimes prefix the commit message with the name of the
module affected by the commit.

More fundamentally, the commit history in git needs to be viewed as a
directed acyclic graph rather than as a linear series of commits, for
example:
  https://github.com/AnalyticalGraphicsInc/cesium/network
git GUIs (e.g. gitx, git-gui, git-cola, GitHub) also display this
information and sort commits so that commits in the same branch appear
together.

In short, there is no need to prefix commit messages with a branch
name: the git tools already solve the original problem.

Regards,
Tom

Gotcha. Thanks Tom.

Patrick