Git rev parse Uses

Git has an endless bags of tricks and git rev-parse is no different. It can be used to output some useful information about your Git repo.

show the current branch name                git rev-parse --abbrev-ref HEAD
show the root directory where git operates  git rev-parse --show-toplevel

A useful bash alias I have to navigate to the root of my project is

alias root='cd "`git rev-parse --show-toplevel`"'

When typing root it automatically takes me to the root of my project.

Read more about git rev-parse

Instagram Post