to add file to last commit
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
git reset myfile # will undo staging
more meaningful alias for reset
git config --global alias.unstage 'reset'
check out files from last commit
git checkout .
note that this is destructive
undoing a commit
git reset --soft HEAD^
more meaningful name
git config --global alias.uncommit 'reset --soft HEAD^'
in vim:
:cq
quits with an error code (which will cause git to abort a commit)