-
-
Save evitolins/7782633 to your computer and use it in GitHub Desktop.
Bash script to determine if current branch need rebase changes from the integration branch.
This file contains 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 | |
# Bash script to determine if current branch(default HEAD) | |
# need rebase the changes from the integration | |
# branch(default master) | |
# Author: Justin Zhang <[email protected]> | |
# 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