Skip to content

Commit 3d2d142

Browse files
committed
feat: add git-downmerge script
1 parent 5970ccd commit 3d2d142

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

git-downmerge

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# import dependency
6+
parentPath=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
7+
. "$parentPath/os-open"
8+
9+
# Check if params are enough to go ahead.
10+
downmergeFrom=$1
11+
downmergeTo=$2
12+
test -z "$downmergeFrom" && echo "Please provide downmerge-from branch and downmerge-to branch." 1>&2 && exit 1
13+
test -z "$downmergeTo" && echo "Please provide both downmerge-from as first argument branch and downmerge-to branch as the second argument." 1>&2 && exit 1
14+
15+
git fetch -p
16+
git checkout -B sync/$downmergeTo
17+
git reset --hard origin/$downmergeTo
18+
git merge origin/$downmergeFrom
19+
echo "resolve conflicts if any"
20+
echo "then do git commit"
21+
echo "and then git push origin sync/$downmergeTo"

0 commit comments

Comments
 (0)