Xavier Olive research teaching python blog til cli

Advanced Git usage patterns

2 January 2022

This is work in progress

Undo latest commit

If the idea is to add, remove or edit a file to your latest commit:

git reset --soft HEAD~

If this was just a mistake, you just want to forget about everything:

git reset --hard HEAD~

Compress your git history

git gc --aggressive --prune=now