Skip to content

Instantly share code, notes, and snippets.

@ifnull
Last active December 22, 2015 10:09
Show Gist options
  • Save ifnull/6456589 to your computer and use it in GitHub Desktop.
Save ifnull/6456589 to your computer and use it in GitHub Desktop.
Git Cheatsheet

Git Cheatsheet

Current commit hash
git log -1 --format="%H"

Current tag
git describe --always --tag --abbrev=0

Current branch
git describe --contains --all HEAD

Get tag's hash
git rev-list v1.0.0 | head -n 1

Get tags with hashes
git show-ref --tags

Get remote tags
git fetch --tags

Validate the existance of a tag
git show-ref --tags --verify "refs/tags/v1.0.0"

Machine readable status
git status --porcelain

Simple status
git status -sb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment