From bab7666666ac34b2fb3d7c0e0b0ec23eceff2c33 Mon Sep 17 00:00:00 2001 From: Motonori Iwata Date: Wed, 7 Sep 2011 17:31:13 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=201.=20short=E3=82=AA=E3=83=97=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=82=92=E5=BB=83=E6=AD=A2=20=202.=20--remov?= =?UTF-8?q?e=E3=82=AA=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=20=203.=20--remote=E3=82=AA=E3=83=97?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=92--upstream=E3=82=AA?= =?UTF-8?q?=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. rebaseをremoteにpushする時ってremote branchを削除しとかないと変なこ とになっちゃい場合があるのでそのオプション追加したいけど結構危い▽そ▼ 操作になるのでshortオプションは廃止。なのでgetopt enhanced環境でないと▽ エラーが表示される。 2. なのでremote削除用のオプションがこれ 3. removeオプション作ったのでremoveオプションだと用途が不明すぎるので▽ 改名。 --- README.mdown | 2 +- git-now-rebase | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/README.mdown b/README.mdown index acff8a2..f9b631b 100644 --- a/README.mdown +++ b/README.mdown @@ -52,7 +52,7 @@ Or simply point your `PATH` environment variable to your git-now checkout directory. -Special Thanks +See also --------------- * [An original git-now idea](http://d.hatena.ne.jp/sinsoku/20101208/1291770514) (by [Toshiyuki Kawanishi](https://github.com/toshi-kawanishi)) diff --git a/git-now-rebase b/git-now-rebase index 702539e..7b4e9ef 100644 --- a/git-now-rebase +++ b/git-now-rebase @@ -1,6 +1,8 @@ usage() { echo "usage: git now rebase []" - echo " git now rebase --push|-p [--remote|-r ] []" + echo " git now rebase --push []" + echo " git now rebase --push --upstream []" + echo " git now rebase --push --remove []" } @@ -34,7 +36,14 @@ cmd_default() { fi if flag push; then - _cmd_push $WORKING_BRANCH $REMOTE + if [ -n "$UPSTREAM_REMOTE" ]; then + git push --set-upstream $UPSTREAM_REMOTE $WORKING_BRANCH + elif [ -n "$REMOVE_REMOTE" ]; then + git push $REMOVE_REMOTE :$WORKING_BRANCH + git push + else + git push + fi fi } @@ -45,23 +54,15 @@ cmd_help() { parse_args() { # parse options - DEFINE_boolean 'push' false 'push to remote repository finally' 'p' - DEFINE_string 'remote' '' 'remote branch name to --set-upstream' 'r' + DEFINE_boolean 'push' false 'push to remote repository finally' '' + DEFINE_string 'remove' '' 'remote name to remove the remote branch before push' '' + DEFINE_string 'upstream' '' 'remote name for --set-upstream' '' FLAGS "$@" || exit $? eval set -- "${FLAGS_ARGV}" # read arguments into global variables BASE_BRANCH=$1 - REMOTE=$FLAGS_remote -} - -_cmd_push() { - local branch=$1 - local remote=$2 - if [ -n "$remote" ]; then - git push --set-upstream ${remote} ${branch} - else - git push - fi + UPSTREAM_REMOTE=$FLAGS_upstream + REMOVE_REMOTE=$FLAGS_remove } From 789abc2375ca5c00e808f3165e47e991fca47a9b Mon Sep 17 00:00:00 2001 From: Motonori Iwata Date: Wed, 7 Sep 2011 17:39:59 +0900 Subject: [PATCH 2/2] update Formula --- git-now.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-now.rb b/git-now.rb index 9842b0a..38d59c8 100644 --- a/git-now.rb +++ b/git-now.rb @@ -1,8 +1,8 @@ require 'formula' class GitNow < Formula - url 'https://github.com/iwata/git-now.git', :tag => 'v0.0.3' - version '0.0.3' + url 'https://github.com/iwata/git-now.git', :tag => 'v0.0.4' + version '0.0.4' head 'https://github.com/iwata/git-now.git', :branch => 'develop' homepage 'https://github.com/iwata/git-now'