Created
December 7, 2019 04:37
-
-
Save imvaskii/d2a867365b7ddcd7e9f232135284e30b to your computer and use it in GitHub Desktop.
Bash fn for current and prev commit hash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/env bash | |
| # Current commit HASH | |
| # %H give commit hash | |
| current_commit() { | |
| git HEAD --pretty=format:"%H" | |
| # git log -n 1 --pretty=format:"%H" | |
| } | |
| # Previous commit HASH | |
| # %P give parent commit hash | |
| previous_commit() { | |
| git HEAD --pretty=format:"%P" | |
| # git log -n 1 --pretty=format:"%P" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment