Rewrite History with Git

edit ✏️

toc

Unstage

git reset -- <file>

rage unstage to wipte out history of staged commit

git reset --hard <file>

Undo file

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"