Skip to content

Instantly share code, notes, and snippets.

@dominikwilkowski
Last active October 8, 2017 23:46
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 dominikwilkowski/1e2d03e4fe2729f78af48ca7caf5abe2 to your computer and use it in GitHub Desktop.
Save dominikwilkowski/1e2d03e4fe2729f78af48ca7caf5abe2 to your computer and use it in GitHub Desktop.

delete pushed tag

git tag -d [tagname]
git push origin :refs/tags/[tagname]

delete latest pushed commit

git push -f origin [hash of the commit you want to move to]:[branch]
git reset [hash of the commit you want to move to]

amend last unpushed commit

git commit --amend

amend last n pushed commit

git rebase -i HEAD~10 # 10 = the last 10 commits

Change to reword and save each

remove last unpushed commit(s)

git reset --hard HEAD^

amend last merge

git reset --hard [hash]

discard local changes

git stash save --keep-index --include-untracked
# git stash drop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment