Dup Ver Goto 📝

GitCommits1

PT2/aw/dev/git does not exist
To
41 lines, 117 words, 759 chars Page 'GitCommits1' does not exist.

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)