Skip to content

Commit 85aee80

Browse files
authored
Merge pull request #41 from honzakuzel1989/git-done-merge-release
2 parents 4b07ca9 + d78c1b8 commit 85aee80

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

git-branch-done

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# git branch-done <branch>
3+
4+
# destination branch as parameter - depends on merge strategy, typically master
5+
DST_BRANCH=""
6+
if [ ! -z "$1" ]; then
7+
DST_BRANCH="$1"
8+
else
9+
echo "Usage: git branch-done <branch>"
10+
exit 1
11+
fi
12+
13+
# get current branch - typically topic branch like taskXXXX, bugXXXX, ...
14+
cb=`git rev-parse --abbrev-ref HEAD`
15+
# no fast forward merge from current branch to destination branch
16+
git checkout $DST_BRANCH && git merge --no-ff $cb && git branch -d $cb

git-merge-to

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# git merge-to <branch>
3+
4+
# destination branch as parameter - depends on merge strategy, typically release
5+
DST_BRANCH=""
6+
if [ ! -z "$1" ]; then
7+
DST_BRANCH="$1"
8+
else
9+
echo "Usage: git merge-to <branch>"
10+
exit 1
11+
fi
12+
13+
# get current branch - typically master or develop
14+
cb=`git rev-parse --abbrev-ref HEAD`
15+
# no fast forward merge from current branch to destination branch
16+
git checkout $DST_BRANCH && git merge --ff $cb && git co $cb

git-release

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# git release <branch>
3+
4+
# destination branch as parameter - depends on merge strategy, typically release
5+
DST_BRANCH=""
6+
if [ ! -z "$1" ]; then
7+
DST_BRANCH="$1"
8+
else
9+
echo "Usage: git release <branch>"
10+
exit 1
11+
fi
12+
13+
# get current branch - typically master or develop
14+
cb=`git rev-parse --abbrev-ref HEAD`
15+
# push current branch, pull destination branch, fast forward merge from current branch to destination branch, push and return
16+
git push && git checkout $DST_BRANCH && git pull && git merge --ff $cb && git push && git checkout $cb

0 commit comments

Comments
 (0)