Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to restore files from previous commit?

I find my commit where I deleted 10 files. After that, I committed a couple of times. NOw I only want to get these 10 files back on my branch

git log --diff-filter=D --summary 

shows

    Deleted 10 TIP files

 delete mode 100644 test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/INT/api-service TIP [Common]/INT_COMMON.json
 delete mode 100644 test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/INT/api-service TIP [Xamarin]/INT_XAMARIN_ANDROID.json
 delete mode 100644 test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/INT/api-service TIP [Xamarin]/INT_XAMARIN_IOS.json
 delete mode 100644 test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/INT/api-service TIP [iOS]/INT_IOS_BitBucket.json
 delete mode 100644 test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/INT/api-service TIP [iOS]/INT_IOS_GitHub.json
 delete mode 100644 test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/PROD/api-service TIP [Common]/PROD_COMMON.json
 delete mode 100644 test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/PROD/api-service TIP [Xamarin]/PROD_XAMARIN_ANDROID.json
 delete mode 100644 test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/PROD/api-service TIP [Xamarin]/PROD_XAMARIN_IOS.json
 delete mode 100644 test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/PROD/api-service TIP [iOS]/INT_IOS_BitBucket.json
 delete mode 100644 test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/PROD/api-service TIP [iOS]/INT_IOS_GitHub.json

I tried

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

git checkout 525afffc8641671f9fe2c33b68dc211ed20d0ec8 -- "test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/INT/api-service TIP [Common]/INT_COMMON.json"

but got error with path

error: pathspec 'test-runner/src/v2/Avalanche.TestRunner.BuildsScenarios/Configuration/INT/api-service' did not match any file(s) known to git

If I go for

    git checkout 525afffc8641671f9fe2c33b68dc211ed20d0ec8
HEAD is now at 525afffc864 Deleted 10 TIP files

What next?

How to fix this?

>Solution :

It looks like 525afffc86... is the commit where you deleted the files.

If such is the case, the files do not exist in that commit, they exist in the parent commit :

# <commit-ish>^ points to the parent of target commit :
git checkout 525afffc^ -- "test-runner/src/v2/ ... /INT_COMMON.json"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading