Finding unmerged commits with git-unmerged

By Zach Dennis on 02 Jul 2009

git-unmerged is a tool that helps you find commits that have not been merged into an upstream branch like master or origin/master. It displays useful information in color to make it easy to identify the missing commits. To make it easier on us, it provides a brief overview, a legend, and a breakdown of each branch. Here’s a sample run:

git-unmerged in action

In the above output, the foo branch has two commits which have not made their way into master. The first commit, 10be33c, is yellow to indicate that this commit is completely missing from master. The second commit, 5e3c3e1, is green to indicate that the changes in this commit have already been merged into master, but in a different commit.

By default, git-unmerged will only show the yellow commits. However, the -a option exists to display all possibly unmerged commits. In addition to the -a option the following options are supported:

  • -remote – this will have git-unmerged compare remote branches against the remote upstream branch, which by default is origin/master.
  • -upstream <branch> – this specifies the upstream branch. By default it is master. When running with the —remote option it defaults to origin/master.
  • -h – display help
  • -v – display version

Real world example

Here’s a snippet from an actual project:

git-unmerged in action 2

This output shows git-unmerged comparing remote branches against the upstream of origin/master. As you can see there quite a few remote branches and not all of them have unmerged changes. The ones with 0/0 commits are branches which can be safely deleted since they don’t have any commits that origin/master doesn’t already have.

git-unmerged is simple to use, simple to install, and is a great tool to have in the toolbox.

Download it


After you download the git-unmerged ruby script, make it executable and put it inside of a directory findable in your $PATH. I put mine in ~/bin/.

Using w/Git

If you keep the git-unmerged name you can run it with git by typing “git unmerged”. If you name it something else you’ll want to setup an alias in your global git configuration.


git-unmerged is a ruby script and as such requires ruby. In addition it requires that you have rubygems and the term-ansicolor 1.0.3 gem. git-unmerged is also a wrapper around the git cherry command, so you’ll need to have a recent enough version of git which supports git cherry.


git-unmerged is a part of our tidbits repository over on github. It’s in the lib/ directory:

Happy hacking.

About Mutually Human

Mutually Human is a custom software design and development consultancy specializing in mobile and web-based products and services. We help our clients design, develop and bring to market innovative products and services based on insightful research and strategy aligned with business objectives. We’ve helped Fortune 500 companies, state governments, and startups.