Skip to content

Commit

Permalink
Merge pull request #2 from honzakuzel1989/git-done-merge-release
Browse files Browse the repository at this point in the history
More usefull scripts for daily work
  • Loading branch information
danimesq authored Oct 19, 2021
2 parents 4e53024 + d78c1b8 commit a73da80
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
16 changes: 16 additions & 0 deletions git-branch-done
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# git branch-done <branch>

# destination branch as parameter - depends on merge strategy, typically master
DST_BRANCH=""
if [ ! -z "$1" ]; then
DST_BRANCH="$1"
else
echo "Usage: git branch-done <branch>"
exit 1
fi

# get current branch - typically topic branch like taskXXXX, bugXXXX, ...
cb=`git rev-parse --abbrev-ref HEAD`
# no fast forward merge from current branch to destination branch
git checkout $DST_BRANCH && git merge --no-ff $cb && git branch -d $cb
16 changes: 16 additions & 0 deletions git-merge-to
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# git merge-to <branch>

# destination branch as parameter - depends on merge strategy, typically release
DST_BRANCH=""
if [ ! -z "$1" ]; then
DST_BRANCH="$1"
else
echo "Usage: git merge-to <branch>"
exit 1
fi

# get current branch - typically master or develop
cb=`git rev-parse --abbrev-ref HEAD`
# no fast forward merge from current branch to destination branch
git checkout $DST_BRANCH && git merge --ff $cb && git co $cb
16 changes: 16 additions & 0 deletions git-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# git release <branch>

# destination branch as parameter - depends on merge strategy, typically release
DST_BRANCH=""
if [ ! -z "$1" ]; then
DST_BRANCH="$1"
else
echo "Usage: git release <branch>"
exit 1
fi

# get current branch - typically master or develop
cb=`git rev-parse --abbrev-ref HEAD`
# push current branch, pull destination branch, fast forward merge from current branch to destination branch, push and return
git push && git checkout $DST_BRANCH && git pull && git merge --ff $cb && git push && git checkout $cb

0 comments on commit a73da80

Please sign in to comment.