Use Visualising Git to Understand What Is Going on with Your Git Commands

Git is a powerful version control system for which you only need a few commands to get your daily tasks done. However, Git can do a lot more – but those commands are hard to remember and when you use them wrong, you may mess up your repository.

You can find many great resources to learn Git on try.GitHub.com. One of the more impressive ones is Visualizing Git. This browser-based “Git” visualises the effect your commands have on your repository. You can commit and branch as you like, while this tool updates the graphical representation of your actions. I find this a great help to understand the more advanced commands of Git.

Git rebase is one command I seldom use and when I do, I will do it most likely the wrong way around. With Visualizing Git I can create a minimalistic example, run the rebase command as I think is right and look at the animation to see if Git sees it the same way. (In my example I wold like to rebase the commit called “fix” on the one named “B”, but I got it the wrong way around)

The wrong way of git rebase

In most cases, this is not what I want. Therefore, I go back a step, checkout the right commit and do it all over again until I got the graphic right:

git rebase as is should be

Beside this free exploration, you can follow along more challenging scenarios, like rewriting the history of a remote repository or cherry picking selected commits – all with the same helpful visualisation.

If you are unsure about the way Git works or what effect a certain command will have, I can highly suggest to use Visualizing Git to find out what is really going on. In my experience, it takes a lot less time to set-up a scenario and try it there as when you try it on your repo and are wrong.

Leave a Comment

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