Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git_undoing_things [2019/02/26 12:23] – [Undoing all staged and unstaged changes] rpjdaygit_undoing_things [2019/02/26 12:32] (current) – [Unstaging staged content] rpjday
Line 132: Line 132:
 </code> </code>
  
 +Example:
  
 +<code>
 +$ git reset -- README
 +</code>
 +
 +==== Restoring accidentally-deleted files ====
 +
 +Recall:
 +
 +<code>
 +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.
 +</code>
 +
 +To restore file from HEAD:
 +
 +<code>
 +$ git checkout HEAD -- <file>
 +</code>
 +
 +To restore file from index:
 +
 +<code>
 +$ git checkout -- <file>
 +</code>
  • git_undoing_things.1551183802.txt.gz
  • Last modified: 2019/02/26 12:23
  • by rpjday