commands.sh

git rev-parse

all

Display metadata related to revisions.

More info →

Examples (3)

Get the commit hash of a branch

git rev-parse branch_name

Get the current branch name

git rev-parse --abbrev-ref HEAD

Get the absolute path to the root directory

git rev-parse --show-toplevel
made by @shridhargupta | data from tldr-pages