Undo a commit

git reset HEAD~

This leaves your working tree (the state of your files on disk) unchanged but undoes the commit and leaves the changes you committed unstaged (so they’ll appear as “Changes not staged for commit” in git status, and you’ll need to add them again before committing).


Source: https://stackoverflow.com/a/927386/2179668


Git – my aliases

git config --global alias.poule 'pull'
git config --global alias.s 'status'
git config --global alias.hist 'log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
git config --global alias.a 'add .'
git config --global alias.pu 'pull'
git config --global alias.ac "!git add . && git commit"
git config --global alias.pp "!git pull && git push"
git config --global alias.po 'push'

My favorite is obviously “ac” because I can do
git ac -m "my commit message"
and this simple line add and commit all the modified files 🙂

And I also use a lot git pp to pull and push in one line!