Skip to content

Commit

Permalink
Merge branch '170115_merge_and_publish'
Browse files Browse the repository at this point in the history
  • Loading branch information
nalssing committed Jan 15, 2017
2 parents 8934025 + 8830529 commit cb11fcb
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
51 changes: 51 additions & 0 deletions git-mr
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"
32 changes: 32 additions & 0 deletions git-pub
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

0 comments on commit cb11fcb

Please sign in to comment.