Skip to content

Instantly share code, notes, and snippets.

@bugsysop
Forked from NathanielInman/git-hash.txt
Created January 26, 2024 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bugsysop/8b6b3a08c430eb7cc0ed67f5fc9bf10f to your computer and use it in GitHub Desktop.
Save bugsysop/8b6b3a08c430eb7cc0ed67f5fc9bf10f to your computer and use it in GitHub Desktop.
Get hashes for git tags
# List all branches and their hashes on remote
git ls-remote --head
# List all tags and their hashes on a remote server
git ls-remote -t
# Get hash for a specific tag
git rev-parse v1.1.0
# Get last tag for current branch
git describe --tags --abbrev=0
# Get hash for last tag on current branch
git rev-parse $(git describe --tags --abbrev=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment