Launch Gitk displaying all branches

Update: All of the below is made totally redundant by simply using ‘gitk --all’. Thanks Russel!

When I launch Gitk, it just displays the current branch. To display other branches, you must name them on the command line. To display all existing branches, you need to find out all the branch names:

$ git branch
* master

Then laboriously type them in to the gitk command line:

$ gitk create-sql-dev formula-rewrite master

Alternatively, save this Bash snippet in a script on your PATH. I call mine gitka, for ‘all branches’:

# run gitk, displaying all existing branches
for b in "`git branch`"; do echo "$b"; done | tr -d "*" | xargs gitk
Gitk displaying all branches, not just the current ('master' in bold)
Gitk displaying all branches, not just the current ('master' in bold)

This works on Windows too, if you save it as ‘’, and have Cygwin installed and associate the .sh filename extension with the Cygwin Bash executable. You can then run it as ‘gitka’ from a Windows command prompt thingy. If you then use ‘ln -s gitka’, then you can also run it as just ‘gitka’ from a Cygwin bash prompt too – without this you would have had to type out the full ‘’.

4 thoughts on “Launch Gitk displaying all branches

  1. Hey Hossain. As you have possibly by now realised, WP ‘helpfully’ converts all instances of double-minus in a post or comment into em-dashes. I think I’ll try to prevent it from doing so by replacing hyphens with “-”, which yields “-”.

  2. it’s “gitk –all” not “gitk –all”
    i became mad trying “gitk –all” 5 minutes :|

  3. Hooray! Thank-you Russel! The answer is simply that I didn’t know ‘–all’ existed. You have saved me from myself.

Leave a Reply