From: Torsten Bögershausen Date: Tue, 18 Mar 2014 19:26:32 GMT Subject: Re: [PATCH] git-rebase: Teach rebase "-" shorthand. Message-ID: <53289DE8.2070104@web.de> In-Reply-To: <1395132268-69488-1-git-send-email-modocache@gmail.com> On 03/18/2014 09:44 AM, Brian Gesiak wrote: > Teach rebase the same shorthand as checkout and merge; that is, that "-" > means "the branch we were previously on". > > Reported-by: Tim Chase > Signed-off-by: Brian Gesiak > --- > git-rebase.sh | 4 ++++ > t/t3400-rebase.sh | 6 ++++++ > 2 files changed, 10 insertions(+) > > diff --git a/git-rebase.sh b/git-rebase.sh > index 5f6732b..2c75e9f 100755 > --- a/git-rebase.sh > +++ b/git-rebase.sh > @@ -453,6 +453,10 @@ then > test "$fork_point" = auto && fork_point=t > ;; > *) upstream_name="$1" > + if test "$upstream_name" = "-" > + then > + upstream_name="@{-1}" > + fi > shift > ;; > esac > diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh > index 6d94b1f..00aba9f 100755 > --- a/t/t3400-rebase.sh > +++ b/t/t3400-rebase.sh > @@ -88,6 +88,12 @@ test_expect_success 'rebase from ambiguous branch name' ' > git rebase master > ' > > +test_expect_success 'rebase using shorthand' ' > + git checkout master we schould have the "&&" ^^ > + git checkout -b shorthand HEAD^ we schould have the "&&" ^^ > + GIT_TRACE=1 git rebase - And why the GIT_TRACE ? > +' > + > test_expect_success 'rebase a single mode change' ' > git checkout master && > git branch -D topic && >