to add file to last commit ```plaintext git add myfile git commit --amend --no-edit # add to previous commit git commit --amend # allow to change commit message git config --global alias.car 'commit --amend --no-edit' ``` to unstage a file ```plaintext git reset myfile # will undo staging ``` more meaningful alias for reset ```plaintext git config --global alias.unstage 'reset' ``` check out files from last commit ```plaintext git checkout . ``` note that this is destructive undoing a commit ```plaintext git reset --soft HEAD^ ``` more meaningful name ```plaintext git config --global alias.uncommit 'reset --soft HEAD^' ``` in vim: ```plaintext :cq ``` quits with an error code (which will cause git to abort a commit)