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?
Gitk is a graphical repository browser. It was the first of its kind. It can be thought of as a GUI wrapper for git log . It is useful for exploring and visualizing the history of a repository.
Gitk was the first graphical repository browser. It's written in tcl/tk. gitk is actually maintained as an independent project, but stable versions are distributed as part of the Git suite for the convenience of end users.
The git branch command lets you create, list, rename, and delete branches. It doesn't let you switch between branches or put a forked history back together again. For this reason, git branch is tightly integrated with the git checkout and git merge commands.
In order to compare two branches easily, you have to use the “git diff” command and provide the branch names separated by dots. Using this command, Git will compare the tip of both branches (also called the HEAD) and display a “diff” recap that you can use to see modifications.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With