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

Filter git log to find deleted file by some user

Long time ago, there was a spike that I did to try something, and then I removed it.

I don’t remember when I removed it (more than a year or maybe two years ago), but it was in our codebase for two or three months.

The spike was a code to read "pfx" files, and include unit tests.

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

I want to see if I can retrieve the code.

All what I know, is the code that I removed

  1. deleted a file with extensions "pfx"
  2. was under our "test" folder
  3. and was removed by me.

Is there a way to find that code

>Solution :

You could use the git log command with a glob pattern to narrow down the list of commits that affected pfx files under the test folder. To help you to identify the test file, you could also add the options:

  • --author to filter for the commits recorded by the given author.
  • --name-only to list the files affected by the commit.
git log --author=<author-name> --name-only master -- test/**/*.pfx

Once you obtain the list of commits, you can enter the detached HEAD state and inspect the desired commits with git checkout.

git checkout <commit-id>
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