Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Dec 3, 2010, 19:00 UTC
- Message-ID
- <20101203190050.GB14049@burratino>
- In-Reply-To
- <AANLkTimyCG6zVhc4znWPWwipd0bn-YT2FrOT=T0AgHNW@mail.gmail.com>
Sverre Rabbelier wrote:
> $ git pull --rebase > usage: git merge-base [-a|--all] [--octopus] <commit> <commit>...
[...]
Show 10 quoted lines
> [... many more snipped ...] > > You are not currently on a branch, so I cannot use any > 'branch.<branchname>.merge' in your configuration file. > Please specify which remote branch you want to use on the command > line and try again (e.g. 'git pull <repository> <refspec>'). > See git-pull(1) for details. > > > There are 127 helpful messages in total.
Does the following take care of it?
cc-ing Santi, author of the very nice v1.6.4.1~6^2 (pull: support rebased upstream + fetch + pull --rebase, 2009-07-19). Maybe we should make merge-base more tolerant.
diff --git a/git-pull.sh b/git-pull.sh index 8eb74d4..bbc369d 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -212,7 +212,7 @@ test true = "$rebase" && { oldremoteref="$(git rev-parse -q --verify "$remoteref")" && for reflog in $(git rev-list -g $remoteref 2>/dev/null) do - if test "$reflog" = "$(git merge-base $reflog $curr_branch)" + if test "$reflog" = "$(git show-branch --merge-base $reflog $curr_branch)" then oldremoteref="$reflog" break