简体   繁体   中英

git - how to recover deleted subfolders/file after git rm -r .*

I am using Windows working with a parentFolder that contain multiple subfolder . I accidentally deleted all the subfolder with git rm -r.* right after I add those. Here is more clear on what I did:

# Parent folder contain subfolder1, subfolder2, etc.
cd Parentfolder 
git init
git add .*
# Accidently delete all folder as followed
git rm -r .*

Now all of my subfolders are gone, I googled all types of recovery software but somehow could not recover the file. Is there anyway I can recover this?

If those files have been committed, then do (first save all the changes since after this operation all changes will be removed ):

git add .
git reset --hard

If these were not committed edits, then you lost them. If you use any IDE and made edits with it, then perhaps it has a means of undoing edits (like, for example, Local History in applications from JetBrains).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM