As far as I understand, git doesn't store branch information in commits. From the perspective of gits logic, where a branch is merely a pointer to a commit, this perfectly makes sense.
However, I would find it helpful to have the branch name stored along with the commit, in order to more easily identify the meaning of branches preserved in the commit history, when combined with git merge --no-ff
.
My (clumsy) current workarounds include
- Typing the branch name as part of the commit name, or committing with a custom command that does just that.
- Tagging commits immediately before a merge with the branch name.
Is there some way to make git preserve the branch name in commits and then display that information as part of git log
without such workarounds?