Add git-finish subcommand, to automate the process of finishing feature and hotfix branches the way I like
This commit is contained in:
parent
1545df64a9
commit
7b32331bd2
1 changed files with 21 additions and 0 deletions
21
local/bin/git-finish
Executable file
21
local/bin/git-finish
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/zsh
|
||||
branch=$1
|
||||
branchParts=( ${(s:/:)branch} )
|
||||
kind=$branchParts[1]
|
||||
name=$branchParts[2]
|
||||
echo "Finishing $kind '$name'..." >&2
|
||||
|
||||
git checkout $branch || exit $?
|
||||
|
||||
merge-into() {
|
||||
echo "Merging $branch into $1..." >&2
|
||||
git checkout $1 || exit $?
|
||||
git merge --no-ff $branch --message "Merge $kind '$name' into $1" || exit $?
|
||||
}
|
||||
|
||||
[[ $kind = hotfix ]] && merge-into master
|
||||
merge-into develop
|
||||
|
||||
echo "Merge successful, deleting $branch..." >&2
|
||||
git push origin --delete $branch || exit $?
|
||||
git branch --delete $branch
|
Loading…
Reference in a new issue