728x90
Given a local / remote branch name, how could I get the hash of the commit that this branch points to?
The command git rev-parse is your friend, e.g.:
$ git rev-parse development
17f2303133734f4b9a9aacfe52209e04ec11aff4
... or for a remote-tracking branch:
$ git rev-parse origin/master
da1ec1472c108f52d4256049fe1f674af69e785d
This command is generally very useful, since it can parse any of the ways of specifying branch names in git, such as:
git rev-parse master~3
git rev-parse HEAD@{2.days.ago}
+
current branch hash point
~1
~2
~3
If we have many of entry, simply point out ~(Want to do before entry point)
'Env Setting > Git' 카테고리의 다른 글
[IntelliJ] How to merge (0) | 2024.03.20 |
---|---|
Merge branch 'master' into others (0) | 2024.03.18 |
When to Git Clone SSL certificate issue (0) | 2024.03.15 |
[RESET] git reset 조지기 (32) | 2023.12.12 |
GIT BASH에서 FATAL: PROTOCOL 'HTTPS' IS NOT SUPPORTED 에러가 날 때 (62) | 2023.03.23 |