Notes to Self

Alex Sokolsky's Notes on Computers and Programming

Git FAQs

Undo the last local commit

git reset HEAD~

Undo Uncommitted or Unsaved Changes

Unstage all the files you might have staged with git add:

git reset

Revert all the local uncommitted changes. Execute in the repo root:

git checkout .

Delete the local repo’s branches

Delete the local branches which are merged:

git branch --merged | grep -v \* | xargs git branch -D

Get all the repo’s branches except for branch master and delete these:

git branch | grep -v master | xargs git branch -D