Instantly share code, notes, and snippets.

What would you like to do?

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