-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmerge-develop
executable file
·57 lines (44 loc) · 1.35 KB
/
merge-develop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
# merge one repo with another
# http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html
# Check arguments
if [ $# -ne 0 ]; then
echo 1>&2 Usage:
echo 1>&2 " checkout the branch you want to merge develop into"
echo 1>&2 " $0"
exit 127
fi
# Check for untracked files
git ls-files --others --error-unmatch . >/dev/null 2>&1; ec=$?
if test "$ec" = 0; then
echo There are some untracked files, stash or commit them before running this command
exit 127
elif test "$ec" = 1; then
echo no untracked files
else
echo error from git ls-files
exit $ec
fi
# Check for staged but uncommitted files
git diff-index --quiet --cached HEAD >/dev/null 2>&1; ec=$?
if test "$ec" = 0; then
echo There are some uncommitted files, stash or commit them before running this command
exit 127
elif test "$ec" = 1; then
echo no uncommited files in the index
else
echo error from git diff-index
exit $ec
fi
current_branch=$(git rev-parse --abbrev-ref HEAD)
echo current_branch=$current_branch
if [ $current_branch = "develop" ]; then
echo 1>&2 Currently on develop branch, cd to the branch you want to merge develop in to
exit 127
fi
git checkout develop
# checked_out_branch=$(git rev-parse --abbrev-ref HEAD)
# echo checked out $checked_out_branch
git pull
# git checkout $current_branch
# git merge develop