git rev-parse
Display metadata related to specific revisions. More information: https://git-scm.com/docs/git-rev-parse.
- 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
This is a tldr pages (source, CC BY 4.0) web wrapper for cheat-sheets.org. All commands, popular commands, most used linux commands. Referrals. Progressive Web Application (PWA) version to install on your device.