mirror of
https://github.com/jbranchaud/til
synced 2026-01-05 08:08:02 +00:00
Add Get The Short Version Of The Latest Commit as a git til
This commit is contained in:
14
git/get-the-short-version-of-the-latest-commit.md
Normal file
14
git/get-the-short-version-of-the-latest-commit.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Get The Short Version Of The Latest Commit
|
||||
|
||||
As part of some automated scripting for an app deployment I wanted to be
|
||||
able to get the short version of the latest commit to the current git repo.
|
||||
Git's `rev-parse` command is the perfect fit for this.
|
||||
|
||||
```bash
|
||||
$ git rev-parse --short HEAD
|
||||
708248b
|
||||
```
|
||||
|
||||
See `man git-rev-parse` for more details.
|
||||
|
||||
[source](https://stackoverflow.com/questions/5694389/get-the-short-git-version-hash)
|
||||
Reference in New Issue
Block a user