Skip to content

Instantly share code, notes, and snippets.

@mbfisher
Last active December 28, 2015 00:08
Show Gist options
  • Save mbfisher/7410700 to your computer and use it in GitHub Desktop.
Save mbfisher/7410700 to your computer and use it in GitHub Desktop.
Git Cheatsheet

Branches

Tracking

Show tracking git branch -vv

Set up on existing local branch or change tracked remote branch git branch -u $remote/$branch [$local]

Renaming

Local git branch -m [$old] $new # Omit old if checked out

Remote git push $remote :$old && git checkout $new && git push $remote $new

Tags

Delete

Local: git tag -d $tag Remote: git push $remote :refs/tags/$tag

If you delete a remote tag that's been pulled by others, you're gonna have a bad time.

Rebase

Remove a commit

git rebase -p --onto $ref^ $ref

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