Skip to content

Instantly share code, notes, and snippets.

@chris-kobrzak
Created June 7, 2018 15:06
Show Gist options
  • Save chris-kobrzak/1a9f0e3bc87a25fc26c2e807a86b76ba to your computer and use it in GitHub Desktop.
Save chris-kobrzak/1a9f0e3bc87a25fc26c2e807a86b76ba to your computer and use it in GitHub Desktop.
Git cheat sheet
# Get the most recent commit ID
git rev-parse HEAD
# Detect if feature branch has been rebased on master
git checkout <your-feauture-branch>
git checkout master
masterHeadId=`git rev-parse HEAD`
git checkout -
git log --pretty=oneline --no-abbrev-commit | grep $masterHeadId | wc -l
# the above prints 1 or 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment