Bash script to determine if current branch need rebase changes from the integration branch.
#!/bin/bash | |
# Bash script to determine if current branch(default HEAD) | |
# need rebase the changes from the integration | |
# branch(default master) | |
# Author: Justin Zhang <fgz@qad.com> | |
# Created: 2013-12-04 | |
# | |
# Usage: | |
# check_rebase.sh [current branch] [integration branch] | |
# | |
trg=$1 | |
itg=$2 | |
if [[ -z $trg ]]; then | |
trg=HEAD | |
fi | |
if [[ -z $itg ]]; then | |
itg=master | |
fi | |
ret=$(git rev-list $trg..$itg) | |
if [[ -z $ret ]]; then | |
echo "You have no need to rebase." | |
else | |
echo "You need rebase to absorb the following changes:" | |
for r in $ret | |
do | |
echo $r | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment