Rewrite History with Git


πŸŽ„This post has fully grown

  • rebase
  • git commit --amend

Unstage learning-python-debugger

git reset -- <file>

rage unstage to wipte out history of staged commit

git reset --hard <file>

Undo file

  • rage quit
  • git reset HEAD~n

    • removes modifications
    • keeps hitsory of changes and undoes them
  • git checkout HEAD~n --

    • keeps modifications
    • removes history
    • --SOFT
    • --HARD
    • --Mixed

undo n commits back

locally before push

git reset HEAD~n

after push

git revert HEAD~n

update .gitignore

after push

git rm -r --cached .
git commit -am "Updated .gitignore"

πŸ‘€ see an issue, edit this post on GitHub

If you found value in this post
and want to send a tip.

Buy Me A Coffee

tweet about this post and it will show up here.

←An IndieWeb Webring πŸ•ΈπŸ’β†’