Reputation: 21178
Is there a way to compare local clone of a GitHub repository to a repository in GitHub which is effectively the master repository to confirm that the local clone is a sub of the GitHub repository?
Upvotes: 1
Views: 83
Reputation: 3054
Because of the nature of git (last commit implies the entire history of that branch), you can validate it by comparing SHA1 of last commit to a credible repository's one.
A simple shell code snippet can be like this (assuming you are only interested in master branch):
if [ $(git rev-parse master^{commit}) == "<official sha1>" ]; then
echo "Good"
else
echo "Bad"
fi
Upvotes: 1