Skip to content

Commit 7078656

Browse files
committed
Restore deleted file.
1 parent 8181a37 commit 7078656

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
* [Don’t consider changes for tracked file.](https://github.com/git-tips/tips#dont-consider-changes-for-tracked-file)
7373
* [Undo assume-unchanged.](https://github.com/git-tips/tips#undo-assume-unchanged)
7474
* [Clean the files from `.gitignore`.](https://github.com/git-tips/tips#clean-the-files-from-gitignore)
75+
* [Restore deleted file.](https://github.com/git-tips/tips#restore-deleted-file)
7576

7677
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
7778
<!-- @doxie.inject end toc -->
@@ -503,5 +504,10 @@ git update-index --no-assume-unchanged <file_name>
503504
git clean -X -f
504505
```
505506

507+
## Restore deleted file.
508+
```sh
509+
git checkout <deleting_commit>^ -- <file_path>
510+
```
511+
506512
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
507513
<!-- @doxie.inject end -->

tips.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,5 +288,9 @@
288288
{
289289
"title": "Clean the files from `.gitignore`.",
290290
"tip": "git clean -X -f"
291+
},
292+
{
293+
"title": "Restore deleted file.",
294+
"tip": "git checkout <deleting_commit>^ -- <file_path>"
291295
}
292296
]

0 commit comments

Comments
 (0)