From: Jonathan Nieder Date: Fri, 03 Dec 2010 19:00:50 GMT Subject: Re: BUG: git pull --rebase on detatched head prints a lot of usage warnings Message-ID: <20101203190050.GB14049@burratino> In-Reply-To: Sverre Rabbelier wrote: > $ git pull --rebase > usage: git merge-base [-a|--all] [--octopus] ... [...] > [... many more snipped ...] > > You are not currently on a branch, so I cannot use any > 'branch..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 '). > 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