Editing
Restoring deleted files in Git
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Recovery Methods == === Method 1: Via Fork Right-Click Menu === Using [https://git-fork.com/ Fork Git client], right-click on <code>Deleted.file</code> and select '''Reset File to'''. # Right-click the deleted file # Select '''Reset File to''' → <code>State at Commit...</code> or <code>State Before Commit...</code> * <code>State at Commit...</code> → Restore to the state at a specific commit * <code>State Before Commit...</code> → Restore to the state before that commit > '''Tip:''' Use the menu directly and click <code>State Before Commit...</code> to quickly restore the file to its state before deletion. === Method 2: Command Line === > '''Note:''' The file path must match exactly (case-sensitive, directory levels must be consistent). # Restore from the latest commit: <pre lang="bash"> git checkout HEAD -- sub_folder/Deleted.file </pre> # Or restore from a specific commit (using commit hash): <pre lang="bash"> git checkout <commit_hash> -- sub_folder/Deleted.file </pre> === Method 3: Restore from Local Changes === If the file still appears as deleted in '''Local Changes''': # Click '''Local Changes''' in the left panel # Locate the file # Right-click → '''Discard Changes'''
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information