Git

Git diff between branches

There are several ways of displaying the differences between your git branches. The simplest ones being a little fuzzy and, if the diff is big enough, not very helpful. But thre are some tweaks we can make. The one I’ve been using mostly in the past weeks is:

$ git log --oneline --graph --all --decorate

Well, like always, when I see too big a command like this, I create an alias for it.
Anyway, this will print the current layout of all branches of your project, including the remote ones.

For example:

git_tree

It produces a cool graph layout with the commit title only, and it’s a very useful way to understand where things are in your project. However, if it’s really a big project, it might be too overwhelming.

I created some new branches with new commits and got a little more elaborated tree, like this:

git_tree_2.png

For the graph above, I created a new branch “bug883” from “develop” and “sample_branch” from “master”. None of them was pushed remotely, as we can tell by the output.

Well, give it a try and share what you think.

Cheers!

UPDATE: Many other ways of getting the diffs are discussed in this Stack Overflow post.

Advertisements