Search code examples
gitgitk

gitk display only specified branches


I want to compare 2 branches using gitk, without the clutter of other branch histories.
I can achieve this via the gui: View > New view > Branches & tags: v0.8.x v0.9.x
I tried the following, but it still shows all branches: gitk --branches v0.8.x v0.9.x
What is the correct syntax?


Solution

  • gitk v0.8.x v0.9.x does it for me.

    However, a closer look on the displayed branches shows me that there are actually not the given branches displayed. In addition, all branches that point to a commit in the history of the two branches are also shown.

    So, the command displays all branches that are specified including those branches that are direct ancestors of the ones specified.


    Edit:

    The --branches= switch would be used if you want to see all branches that are, for example, named fix/*:

    gitk --branches=fix/*
    

    would show you all branches that are matching the given shell glob.

    See also the docs of gitk for a deeper explanation.