Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.9k views
in Technique[技术] by (71.8m points)

git - Find commit to find a very old deleted file in Azure Devops

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...