Last active
December 4, 2024 15:38
-
-
Save joakin/67f5afdd083ccfb8fecd to your computer and use it in GitHub Desktop.
finding a deleted file in a git repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you don't remember the exact path/name, search the log for deleted files | |
git log --diff-filter=D --summary | grep delete | |
# Find the file you want to get from the ouput, and use the path | |
# Find the commits that involved that path | |
git log --all -- some/path/to/deleted.file | |
# Bring the file back to life to the current repo (sha commit of parent of commit that deleted) | |
git checkout shaofthecommitthatdeletedthefile^ -- some/path/to/deleted.file |
thnx bruh
This has been so helpful! Thank you!
what is this g co
? I can't run this command
@shofwan a git checkout
alias I have. I’ll clarify
Really helpful
Thanks! This was super helpful!
thank you!
Amazing - thank you!
Helpful 👍
The first command shows me the deleted file path but the second returns nothing
nice thanks
Cheers!
Awesome, thank you.
2nd command was helpful for me, thanks!
so nice !
Thanks!!!
beautiful
Thanks!
🚀
love the script name.
Shukran
Legend!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you! :-)