Git Log All Branches

I can’t be the only person who always seems to be switching between multiple development branches. Sometimes I get distracted for a few days (I’m also part time, which doesn’t help!) and then I can’t even remember what I was doing or what the branch was called.

The remedy for this situation? The --all switch to git log.

Usually I use git log with --oneline, mostly also with --decorate, often with --graph, and in this specific scenario, also with --all to show reachable commits other than ones that HEAD descended from. The result looks something like this:

git-log-all-cropped

Here you can see there are a couple of branches which come off master (on the left) and haven’t yet been merged back in. It’s very useful to be able to spot these!

Another tip for GitHub users is to click on “branches” when viewing a repo on the web – by default it shows you the unmerged ones.

5 thoughts on “Git Log All Branches

  1. Pingback: What's the difference between git reflog and log? - QuestionFocus

  2. In a “multi-person” team something like that could also be useful:

    git log –format=’format:%h %cs %s (%an)’ –all | grep “your name” | grep “2023-11” | less

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)