HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

git rev-parse — Display metadata related to revisions. More information: <https://git-scm.com/docs/git-rev-parse>.

Submitted by: @import:tldr-pages··
0
Viewed 0 times
relatedcommandmetadataclirevisionsmoregit rev-parsedisplay

Problem

How to use the git rev-parse command: Display metadata related to revisions. More information: <https://git-scm.com/docs/git-rev-parse>.

Solution

git rev-parse — Display metadata related to 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

Code Snippets

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

Context

tldr-pages: common/git rev-parse

Revisions (0)

No revisions yet.