简体   繁体   中英

How to recover locally deleted files that has not been committed after changes

I have a folder that all files have been deleted. I can see all the files by doing this command :

git ls-files --deleted

I've made locally changes that have not been added/committed.

How can I restore all the files with my last modifications ?

Thanks !

If you run git status you will be given some information about the current state and what you could do.

You may recover a locally deleted file, to a state known to git, with:

git checkout -- <file>

Any changes made to the file is lost if you have not staged it ( git add <file> ) before you deleted it.

Some IDE:s keeps a local history of files changed by the IDE, maybe you could find your changes there after you restored them from git.

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