Sublime Forum

Display branch name in history view

#1

in the timeline view where all branches/ merges of branches are shown, how can I see the name of the branches?
other than the occasional name at the very top/ HEAD?

thanks

1 Like

#2

As far as I’m aware, with regards to branch names and the commit graph the names of branches are only displayed at their head commit, both in the graph and in the pane on the right in the commit details when you select that commit.

Apart from the head commit, I don’t think git contains any information as to what branch a commit originally came from? Or if you will, if I create branch new-branch, make 4 commits, merge that branch back with master and then delete new-branch, I don’t think there is any historical way to know what the name of the branch was when those 4 commits were made.

The git command git branch -a --contains <hash> gets git to display the names of all branches whose commit tree contains the commit hash you provide, which always seems to be constrained to only branches that currently exist.

If you’re interested in that kind of information, you can add the following to a file named Commit.sublime-menu in your Merge User package to add a command to the context menu in the commit tree to execute that command (output viewable by clicking the icon in the info bar):

[
    { "caption": "-", "id": "end" },

    {
        "caption": "Show Branches containing this commit...",
        "command": "git",
        "args": {"argv": ["branch", "-a", "--contains", "$commit"]}
    },
]
2 Likes

#3

this actually makes much sense to me, hadn’t thought about it this way. I just thought a GUI should provide this information although I never missed it in the CLI yet, but your argument might be the reason why I have not seen it in the CLI.

thanks for the git command help as well !

0 Likes

#4

The only solution I can imagine was to add a list of “contained by …” to the commit details panel.

GitExtensions lists all branches and tags, that contain a selected commit.

1 Like

#5

Well, somehow it is working in standard gitk GUI that comes with git

0 Likes