A common problem in git is finding the commit that deleted a file. The mechanism for doing this in a local repo is well-known:

git log -- path/to/deleted/file

There are variations on this command to control how hard you want to look, and which branch you want to look in, but that's the basic idea.

But what if you want to do this on a hosted repo?

For GitHub, you can ask for the history of a file in a branch, and the secret is that GitHub doesn't mind when you specify a deleted file.

https://github.com/⟦user⟧/⟦project⟧/commits/⟦branch⟧/⟦path/to/deleted/file⟧

For example, to find the commit that deleted Samples/ApplicationData/cs/Scenario5_DataChangedEvent.xaml.cs from the main branch of the UWP Samples Repo at https://github.com/microsoft/Windows-universal-samples/, you can go to https://github.com/microsoft/Windows-universal-samples/commits/main/Samples/ApplicationData/cs/Scenario5_DataChangedEvent.xaml.cs

continue reading on devblogs.microsoft.com

⚠️ This post links to an external website. ⚠️