Files
30-seconds-of-code/snippets/restore-deleted-file.md
2022-05-04 19:36:40 +03:00

569 B

title, tags, expertise, author, cover, firstSeen, lastUpdated
title tags expertise author cover firstSeen lastUpdated
Restore a deleted file branch intermediate chalarangelo blog_images/succulent-red-light.jpg 2021-04-06T20:58:25+03:00 2021-04-13T21:10:59+03:00

Restores a file deleted in a specific commit.

  • Use git checkout <commit>^ -- <file> to restore the specified <file> deleted in the specified <commit>.
git checkout <commit>^ -- <file>
# "30seconds.txt" was deleted in the commit `3050fc0de`
git checkout 3050fc0de^ -- "30seconds.txt"
# Restores the 30seconds.txt file