-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '170115_merge_and_publish'
- Loading branch information
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
BR_MASTER="master" | ||
|
||
if [ $# -ne 0 ] | ||
then | ||
echo "usage: $0" | ||
exit 1 | ||
fi | ||
|
||
BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD)" | ||
|
||
|
||
if [ "$BRANCH_NAME" == "$BR_MASTER" ] | ||
then | ||
echo "You are on branch $BR_MASTER." | ||
exit 1 | ||
fi | ||
|
||
git checkout $BR_MASTER | ||
git fetch | ||
|
||
if [ $(git rev-parse $BRANCH_NAME) != $(git rev-parse origin/$BRANCH_NAME) ] | ||
then | ||
echo "$BRANCH_NAME is not updated to the latest revision." | ||
exit 1 | ||
fi | ||
|
||
if [ $(git rev-parse $BR_MASTER) != $(git rev-parse origin/$BR_MASTER) ] | ||
then | ||
echo "$BR_MASTER is not updated to the latest revision." | ||
exit 1 | ||
fi | ||
|
||
git merge "$BRANCH_NAME" --no-ff | ||
if [ $? -ne 0 ] | ||
then | ||
exit 2 | ||
fi | ||
git push origin ":$BRANCH_NAME" | ||
if [ $? -ne 0 ] | ||
then | ||
exit 2 | ||
fi | ||
git branch -d "$BRANCH_NAME" | ||
if [ $? -ne 0 ] | ||
then | ||
exit 2 | ||
fi | ||
|
||
echo "$BRANCH_NAME is merged to $BR_MASTER. Please push to update remote" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
if [ $# -ne 0 ] | ||
then | ||
echo "usage: $0" | ||
exit 1 | ||
fi | ||
|
||
BR_MASTER="master" | ||
|
||
CURRENT=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
STATUS=$(git branch -vv) | ||
|
||
# push를 해봅시다 | ||
# tracking이 되는지 확인 | ||
if [[ $STATUS == *origin/$CURRENT* ]] | ||
then | ||
# 이미 push가 되었는지 확인 | ||
if [ $(git rev-parse $CURRENT) != $(git rev-parse origin/$CURRENT) ] | ||
then | ||
git push origin $CURRENT | ||
fi | ||
else | ||
git push -u origin $CURRENT | ||
fi | ||
|
||
if [ $? -ne 0 ] | ||
then | ||
echo "Push failed" | ||
exit 1 | ||
fi |