-sep
-
- LOCAL=$(git rev-parse @)
- REMOTE=$(git rev-parse "$branch")
- BASE=$(git merge-base @ "$branch")
-var branch LOCAL REMOTE BASE
-
- if [ "$LOCAL" == "$REMOTE" ]; then
- echo "Up-to-date"
- to_return=0
- elif [ "$LOCAL" == "$BASE" ]; then
- echo "Need to pull"
- to_return=1
- elif [ "$REMOTE" == "$BASE" ]; then
- echo "Need to push"
- to_return=2
+ local local_branch=$(git rev-parse @)
+ local remote_branch=$(git rev-parse "$branch")
+ local merge_base=$(git merge-base @ "$branch")
+
+ if [ "$local_branch" == "$remote_branch" ]; then
+ echo "okay"
+ elif [ "$local_branch" == "$merge_base" ]; then
+ echo "needs_pull"
+ elif [ "$remote_branch" == "$merge_base" ]; then
+ echo "needs_push"