Created
August 13, 2020 15:57
-
-
Save afirth/fb3b4dcd3ce1db9adc58993ff09cd02d to your computer and use it in GitHub Desktop.
recover staged or reset files in git (ran git add but somehow discarded without committing)
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
export UNIQUE_CODE=sops_version | |
#from https://stackoverflow.com/a/14988152/13484536 | |
for b in $(git fsck --lost-found | grep blob | awk '{print $3}'); do git cat-file -p $b | grep -q ${UNIQUE_CODE} && echo $b && git cat-file -p $b && echo; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment