środa, 11 grudnia 2013

Revive deleted file from Git

You accidentally deleted one file which you didn't want to. But together with a bunch of other files you no longer need. Well, you can make a temporary branch off the "last good" Git commit and take the file from there. But there is a better way.
git show LAST_GOOD_COMMIT_HASH:path/to-the/file > path/to-the/file
# if you have just done it so it has happened in the last commit
git show HEAD^1:path/to-the/file > path/to-the/fil
e
... etc, so in general:
git show COMMIT:path/to-the/file > path/to-the/file

Brak komentarzy:

Prześlij komentarz