Skip to content

Instantly share code, notes, and snippets.

@vierbergenlars
Created February 1, 2016 08:59
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 vierbergenlars/5459016b021ee604bd72 to your computer and use it in GitHub Desktop.
Save vierbergenlars/5459016b021ee604bd72 to your computer and use it in GitHub Desktop.
bad_trees=$(git fsck 2>&1 | awk '{print $4}' | sed s/://)
commits_with_bad_root_tree=$(git log --pretty=format:%H:%T | grep -E '('$(echo "$bad_trees" | tr "\n" '|' | sed s/.$//)')$' | cut -d: -f1)
echo "$bad_trees" | wc -l
echo "$commits_with_bad_root_tree" | wc -l
echo "$commits_with_bad_root_tree" | git log --stdin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment