Last active
August 29, 2015 14:04
-
-
Save AustinDizzy/f685fb40d6a4b5cbeac1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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" ] || [ "$1" == "help" ] ; then | |
echo | |
echo "Usage: git check [remote]:[branch]" | |
echo | |
else | |
OPTS=(${1//:/ }) | |
remote=${OPTS[0]} | |
branch=${OPTS[1]} | |
$(git fetch $remote) | |
remote_c=$(git rev-parse $remote/$branch) | |
local_c=$(git rev-parse $branch) | |
echo | |
printf "Local ($branch) : %s\nRemote ($branch): %s\n" $local_c $remote_c | |
echo | |
if [[ $local_c == $remote_c ]]; then | |
echo "Remote is up to date" | |
else | |
echo "Remote $1 is ahead or behind local $branch." | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment