-
Notifications
You must be signed in to change notification settings - Fork 0
/
automerge.sh
executable file
·54 lines (40 loc) · 1.11 KB
/
automerge.sh
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
#!/bin/bash
# Auto-merge branch between each other
#
# checkout_and_rebase branch_to_checkout branch_to_merge_in
# Cancel if any error
function checkout_and_rebase()
{
echo "$1" > .current_merge
git checkout "$1" || exit 1
git pull --rebase || exit 1
git merge --no-edit "$2" || exit 1
rm .current_merge
}
function pre_checkout_and_rebase()
{
if [ ! -f .current_merge ]
then checkout_and_rebase $1 $2
return
fi
stopped_merge="$(cat .current_merge)"
if [ "$1" == "$stopped_merge" ]
then rm .current_merge
else
return
fi
}
# Merge master and desktop in desktop
pre_checkout_and_rebase "desktop" "master"
### DESKTOP CHILDS ###
pre_checkout_and_rebase "tour-anthony" "desktop"
### TOUR-ANTHONY CHILDS ###
pre_checkout_and_rebase "laptop-anthony" "tour-anthony"
### END TOUR-ANTHONY CHILDS ###
### LAPTOP-ANTHONY CHILDS ###
# pre_checkout_and_rebase "laptop-work" "laptop-anthony"
### END LAPTOP-ANTHONY CHILDS ###
### END DESKTOP CHILDS ###
if [ -f favorite ]
then git checkout $(cat favorite) || exit 1
fi