Git commit history graph in the terminal

27 Mar 2021 / ERap320

A history graph, like the ones provided by Github and Gitlab are very useful to check how your branches interact at a glance. However, git is always difficult to control and you may want to make sure you didn't break your precious repository before pushing. With this simple command, you can view the usual log visually organized as a graph:

git log --graph --pretty=oneline --abbrev-commit

Alias

If you also think this command may be very useful and you don't want to type it every time, you can create an alias for it. If you are using "Git Bash" for Windows like I do, you can do it this way:

cd && echo "alias git-graph='git log --graph --pretty=oneline --abbrev-commit'" >> .bash_profile

The next time you open Git Bash, git-graph will be available.



1