File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,28 @@ function TrapExit {
1010
1111batchMode=false
1212
13- while getopts " b " arg
13+ while getopts " hbt: " arg
1414do
1515 case $arg in
1616 b)
1717 batchMode=true
1818 ;;
19+ t)
20+ tag=${OPTARG}
21+ ;;
22+ h)
23+ echo "
24+ Usage $0 [options]
25+
26+ Options:
27+ -b enable batch mode, which avoids interactive prompts and causes script to fail immediately
28+ when any merge fails
29+ -t TAG tag and push the current revision on master with the given tag
30+ and apply respective tags to each branch
31+ -h display this help and exit
32+ "
33+ exit
34+ ;;
1935 * )
2036 echo " Unsupported arg $arg "
2137 exit 2
@@ -34,6 +50,10 @@ test -d ./.git || { echo ".git folder was not found. Please start this script fr
3450git checkout master
3551git pull --all || { echo " Can't pull the repo!" ; \
3652 exit 1; }
53+ if [[ $tag ]]; then
54+ git tag $tag
55+ git push origin $tag
56+ fi
3757
3858git_branches=$( git branch -a)
3959
@@ -57,6 +77,10 @@ for branch in "${branches_list[@]}"; do
5777 git commit -m " Auto merge branch with master" -a
5878 # push may fail if remote doesn't have this branch yet. In this case - sending branch
5979 git push || git push -u origin " $branch " || { echo " Can't push changes to the origin." ; exit 1; }
80+ if [[ $tag ]]; then
81+ git tag " $tag -$branch "
82+ git push origin " $tag -$branch "
83+ fi
6084 elif ${batchMode} ; then
6185 status=$?
6286 echo " Git merge failed in batch mode"
You can’t perform that action at this time.
0 commit comments