Skip to content

Instantly share code, notes, and snippets.

@paulononaka
Last active December 15, 2015 15:59
Show Gist options
  • Save paulononaka/5286136 to your computer and use it in GitHub Desktop.
Save paulononaka/5286136 to your computer and use it in GitHub Desktop.
git tips
== last commit that changed a specific file
git rev-list -n 1 HEAD -- <file_path>
== checkout file from commit
git checkout <deleting_commit>^ -- <file_path>
== list files changed in one specific commit
git diff-tree --no-commit-id --name-only -r <commit>
== how to create a patch from last commit
git format-patch -n HEAD^
== how to delete remote tags
git tag -d 12345
git push origin :refs/tags/12345
== how to delete a bulk of remote tags
git tag | awk '/QA.*/ {print $1}' | xargs git tag -d
git ls-remote --tags origin | awk '/QA.*/ {print ":" $2}' | xargs git push origin
== create and switch to a new branch
git checkout -b branch_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment