git rev-parse
Display metadata related to specific revisions.
- 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
Copyright © 2014—present the tldr-pages team and contributors.
This work is licensed under the Creative Commons Attribution 4.0 International License (CC-BY).