warolv
10/10/2013 - 12:37 PM

Undo Changes

Undo Changes

git reset --soft HEAD^   -> undo last commit and save changes  
git reset --hard HEAD~1  -> undo last commit and remove changes
git reset --hard HEAD~2  -> undo 2 last commits and remove changes
git revert commit-hash  -> create new commit which reverts last commit
git checkout .  -> remove all uncommitted changes
git checkout filename -> undo changes in specific file
git clear -df  -> remove all untracked files
git rm filename -> remove file from index, after your did git add filename 
git commit --amend -> change message of last commit