Created
November 4, 2021 23:13
-
-
Save staticfloat/c5bca982edf15d7f550b2a841ade2e1f to your computer and use it in GitHub Desktop.
Helper script to find a treehash in a git repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -z "$1" ]]; then | |
echo "Usage: git-find-treehash <treehash>" >&2 | |
exit 1 | |
fi | |
commits=$(git log --pretty='%H %T' $commithash | grep $1 | awk '{print $1}') | |
if [[ -n "${commits}" ]]; then | |
echo "Found at commits: $commits" | |
exit 0 | |
else | |
echo "Unable to find any commits with treehash $1" >&2 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment