Created
February 5, 2014 18:15
-
-
Save leroix/8829846 to your computer and use it in GitHub Desktop.
Git: check if a branch is sync'd with a branch of the same name in a remote repo e.g. `check-remote-sync development origin`. Returns nothing if in sync.
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 | |
LOCAL_BRANCH=$1 | |
REMOTE_BRANCH="${2:-origin}/$1" | |
if [ x"$(git rev-parse $LOCAL_BRANCH)" != x"$(git rev-parse $REMOTE_BRANCH)" ] | |
then | |
echo "$LOCAL_BRANCH is not in sync with $REMOTE_BRANCH. You may want to rebase or push first." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment