
Untitled
By: a guest on
Jul 17th, 2012 | syntax:
None | size: 0.50 KB | hits: 16 | expires: Never
How to see if local git repo and remote repo are same commit?
git fetch origin
git rev-parse master
git rev-parse origin/master
remote=$(
git ls-remote -h origin master |
awk '{print $1}'
)
local=$(git rev-parse HEAD)
printf "Local : %snRemote: %sn" $local $remote
if [[ $local == $remote ]]; then
echo "Commits match."
else
echo "Commits don't match."
fi
Local : 9e1b4dc286acb442f7f604be7916db660b9d70cd
Remote: 9e1b4dc286acb442f7f604be7916db660b9d70cd
Commits match.