blob: d5592fe0cf0a2009ae718e242eefb7efbe5f00ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
---
tags:
- git
references:
- https://stackoverflow.com/questions/7203515/how-to-find-a-deleted-file-in-the-project-commit-history
---
Find a (deleted) file in all commits.
`g lg --all --full-history -- "**/shell.nix"`
or more generally
`g lg --all --full-history -- <path-to-file>`
then using the SHA
`g show <sha> -- <path-to-file>`
**Epic bonus**
Restore the file:
`g checkout <sha>^ -- <path-to-file>`
the caret (`^`) references one commit before sha, because in sha it is deleted.
|