简体   繁体   中英

How do I recover files using git?

I committed 2 days ago. Then, I made changes to some of the files.

However, inside one specific directory, I didn't make any changes to it recently.

Today, I deleted those files using rm * inside that directory.

How can I restore files to that directory using git?

Simply use this:

cd <specific_dir>
git checkout .

It will restore all files and directories in current directory which were tracked by git.

Be aware that this will overwrite uncommitted changes to other files in current directory.

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