Reputation: 136
I started working on this project a little over a year ago, and it seems a file is missing from what may be even longer than that. I am trying to go back into my repo to find when this file may have been removed but I do not know what commit let alone the date or user who may have done it.
It seem that in Azure Devops I can only search by name, path, user, date, or by just going thru every commit ever until I find the file lol. I have gone thru the history of the file that contains it but again without knowledge of the date or user or commit, I have no way to find it?
I have tried git commands, something along the lines of
$ git log --all --full-history -- <path-to-file>
$ git log --all --full-history -- **/thefile.*
or stuff I've found here on stack, like
grep -rnw '/path/to/somewhere/' -e 'pattern'
and all the alternate version of that.
These and many commands or routes to find it in the actual Azure Devops backend site that's attached to Visual Studios... just all don't seem to help.
Hoping anyone knew of a way around this or a command to find it? Thanks!
Upvotes: 7
Views: 7659
Reputation: 2333
There's an easy way to do this through Visual Studio, but it requires some knowledge (or guess) of when the file may have existed:
Git
--> View Branch History
).Compare Commits...
If your commit selection in step 2 was in range of when the file existed, the resulting compare window will show the now-deleted file with a strikethrough. Right-click it and select View History
. The top commit in the history is the one where the file was deleted. At that point you can view the commit details or do whatever else you want to do with the commit.
Upvotes: 0
Reputation: 136
The first command suggested by PieDev works, but the 2nd set of commands did not return any information, they might not be wrong, they just didn't help me specifically.
This solution to a similar post guided me to the following solution:
git log --diff-filter=D --summary | grep -E 'delete|^commit\s+\S+'
this will display all the deleted files AND the commits that pushed the changes.
Upvotes: 7
Reputation: 197
What about searching all deleted files?
git log --diff-filter=D --summary | grep delete
Show history on that file (or what you have in your original post)
git log --all -- DeletedFilePath
git show COMMIT_ID -- DeletedFilePath
Upvotes: 7