mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 23:28:02 +00:00
Add Get The Short Version Of The Latest Commit as a git til
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
||||
|
||||
_560 TILs and counting..._
|
||||
_561 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -155,6 +155,7 @@ _560 TILs and counting..._
|
||||
- [Dry Runs in Git](git/dry-runs-in-git.md)
|
||||
- [Excluding Files Locally](git/excluding-files-locally.md)
|
||||
- [Find The Initial Commit](git/find-the-initial-commit.md)
|
||||
- [Get The Short Version Of The Latest Commit](git/get-the-short-version-of-the-latest-commit.md)
|
||||
- [Grab A Single File From A Stash](git/grab-a-single-file-from-a-stash.md)
|
||||
- [Grep For A Pattern On Another Branch](git/grep-for-a-pattern-on-another-branch.md)
|
||||
- [Grep Over Commit Messages](git/grep-over-commit-messages.md)
|
||||
|
||||
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