Skip to content

Instantly share code, notes, and snippets.

@RobinDaugherty
Last active January 5, 2024 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobinDaugherty/d2fcd97d5d1f4edb111f3b67befd67dd to your computer and use it in GitHub Desktop.
Save RobinDaugherty/d2fcd97d5d1f4edb111f3b67befd67dd to your computer and use it in GitHub Desktop.
Locate dangling git commit containing a matching file path
for sha in $(git fsck --no-reflog | awk '/dangling commit/ {print $3}'); do
if git show --name-only $sha | grep -q 'apollo-codegen'; then
echo "Found in $sha";
git log -n 1 $sha;
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment