Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| git_undoing_things [2019/02/26 12:15] – [Undoing all staged and unstaged changes] rpjday | git_undoing_things [2019/02/26 12:32] (current) – [Unstaging staged content] rpjday | ||
|---|---|---|---|
| Line 114: | Line 114: | ||
| < | < | ||
| $ git reset --hard | $ git reset --hard | ||
| + | </ | ||
| + | |||
| + | ==== Unstaging staged content ==== | ||
| + | |||
| + | From '' | ||
| + | |||
| + | < | ||
| + | git reset [< | ||
| + | |||
| + | ... | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | and reports what has not been updated. This is the | ||
| + | | ||
| + | </ | ||
| + | |||
| + | Example: | ||
| + | |||
| + | < | ||
| + | $ git reset -- README | ||
| + | </ | ||
| + | |||
| + | ==== Restoring accidentally-deleted files ==== | ||
| + | |||
| + | Recall: | ||
| + | |||
| + | < | ||
| + | git checkout [< | ||
| + | Overwrite paths in the working tree by replacing with the | ||
| + | contents in the index or in the < | ||
| + | commit). When a < | ||
| + | the < | ||
| + | working tree. | ||
| + | </ | ||
| + | |||
| + | To restore file from HEAD: | ||
| + | |||
| + | < | ||
| + | $ git checkout HEAD -- < | ||
| + | </ | ||
| + | |||
| + | To restore file from index: | ||
| + | |||
| + | < | ||
| + | $ git checkout -- < | ||
| </ | </ | ||