This is an old revision of the document!


Various ways to undo, backpedal and regret.

$ git reset --hard

From man git-checkout:

git checkout [<tree-ish>] [--] <pathspec>...
    Overwrite paths in the working tree by replacing with the
    contents in the index or in the <tree-ish> (most often a
    commit). When a <tree-ish> is given, the paths that match
    the <pathspec> are updated both in the index and in the
    working tree.

To undo some local (unstaged) edits to README, overwrite your local copy with the copy from the index:

$ git checkout -- README

To undo all unstaged changes:

$ git checkout -- .
  • git_undoing_things.1551174284.txt.gz
  • Last modified: 2019/02/26 09:44
  • by rpjday