Skip to content

Instantly share code, notes, and snippets.

View vrom911's full-sized avatar
🦄

Veronika Romashkina vrom911

🦄
View GitHub Profile
@leroix
leroix / check-remote-sync.sh
Created February 5, 2014 18:15
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.
#!/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