TIMEX
TIMEX

Reputation: 272254

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?

Upvotes: 0

Views: 76

Answers (1)

mvp
mvp

Reputation: 116407

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.

Upvotes: 3

Related Questions