Skip to content

Instantly share code, notes, and snippets.

@masaru-b-cl
Forked from mzp/gist:1131618
Last active September 14, 2016 04:58
Show Gist options
  • Save masaru-b-cl/3753414 to your computer and use it in GitHub Desktop.
Save masaru-b-cl/3753414 to your computer and use it in GitHub Desktop.
git-master
#!/bin/sh
WORKING_BRANCH=`git branch -l | grep "*" | cut -d " " -f 2`
IFS_ORIG=$IFS
IFS=#
arr=($WORKING_BRANCH)
IFS=$IFS_ORIG
size=${#arr[@]}
if test $size -eq 1
then
MASTER=${1:-"master"}
else
MASTER=${1:-${arr[0]}}
fi
git rebase $MASTER && git checkout $MASTER && git reset --hard $WORKING_BRANCH && git branch -D $WORKING_BRANCH
#!/bin/sh
MASTER=${1:-"master"}
WORKING_BRANCH=`git branch -l | grep "*" | cut -d " " -f 2`
git checkout $MASTER && git merge $WORKING_BRANCH --no-ff && git reset --hard $WORKING_BRANCH && git branch -D $WORKING_BRANCH
@masaru-b-cl
Copy link
Author

ワーキングブランチ名がworking#feature形式の場合、masterでなくworkingrebaseする。
(see. https://gist.github.com/masaru-b-cl/5b461ffd4728ab9b61cb/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment