git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 2 of 8 in “BUG: git pull --rebase on detatched head prints a lot of usage warnings”
  1. Sverre RabbelierDec 3, 2010
  2. Jonathan NiederDec 3, 2010
  3. Sverre RabbelierDec 3, 2010
  4. Santi BéjarDec 3, 2010
  5. Sverre RabbelierDec 3, 2010
  6. Junio C HamanoDec 3, 2010
  7. Santi BéjarDec 3, 2010
  8. Junio C HamanoDec 3, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.