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

Re: [PATCH] rebase: use @{upstream} if no upstream specified

From
Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Date
Feb 9, 2011, 00:28 UTC
Message-ID
<alpine.DEB.2.00.1102081916330.9042@debian>
In-Reply-To
<20110208220505.GA17981@elie>
On Tue, 8 Feb 2011, Jonathan Nieder wrote:
Show 10 quoted lines
> Martin von Zweigbergk wrote:
> > On Tue, 8 Feb 2011, Sverre Rabbelier wrote:
> 
> >> I particularly like that you explain to the user clearly what they
> >> have to do to make this work (e.g., configure the upstream). Nice.
> >
> > Thanks, but that was stolen from git-pull.sh ;-)
> 
> Doesn't that suggest it might belong in some common git-upstream--lib.sh
> (or git-sh-setup.sh)?
Maybe it does... For comparison, I pasted the two sections below.
git-rebase.sh (after my patch):
	if test -z "$branch_name"
	then
		die "You are not currently on a branch, so I cannot use any
'branch.<branchname>.merge' in your configuration file.
Please specify which upstream branch you want to use on the command
line and try again (e.g. 'git rebase <upstream branch>').
See git-rebase(1) for details."
	else
		die "You asked me to rebase without telling me which branch you
want to rebase against, and 'branch.${branch_name#refs/heads/}.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git rebase <upstream branch>').
See git-rebase(1) for details."
	fi
git-pull.sh:
	elif [ -z "$curr_branch" ]; then
		echo "You are not currently on a branch, so I cannot use any"
		echo "'branch.<branchname>.merge' in your configuration file."
		echo "Please specify which remote branch you want to use on the command"
		echo "line and try again (e.g. 'git pull <repository> <refspec>')."
		echo "See git-pull(1) for details."
	elif [ -z "$upstream" ]; then
		echo "You asked me to pull without telling me which branch you"
		echo "want to $op_type $op_prep, and 'branch.${curr_branch}.merge' in"
		echo "your configuration file does not tell me, either. Please"
		echo "specify which branch you want to use on the command line and"
		echo "try again (e.g. 'git pull <repository> <refspec>')."
		echo "See git-pull(1) for details."
		echo
		echo "If you often $op_type $op_prep the same branch, you may want to"
		echo "use something like the following in your configuration file:"
		echo
		echo "    [branch \"${curr_branch}\"]"
		echo "    remote = <nickname>"
		echo "    merge = <remote-ref>"
		test rebase = "$op_type" &&
			echo "    rebase = true"
		echo
		echo "    [remote \"<nickname>\"]"
		echo "    url = <url>"
		echo "    fetch = <refspec>"
		echo
		echo "See git-config(1) for details."

I had forgotten that I trimmed the last part of it. Maybe I should have also included that? Then it would make even more sense to extract this piece of code.

/Martin
Previous: Jonathan NiederNext: Martin von Zweigbergk
Message 6 of 12 in “rebase: use @{upstream} if no upstream specified”
  1. rebase: use @{upstream} if no upstream specifiedMartin von Zweigbergk, Feb 8, 2011
  2. Sverre RabbelierFeb 8, 2011
  3. Martin von ZweigbergkFeb 8, 2011
  4. Sverre RabbelierFeb 8, 2011
  5. Jonathan NiederFeb 8, 2011
  6. Martin von ZweigbergkFeb 9, 2011
  7. Martin von ZweigbergkFeb 9, 2011
  8. Jonathan NiederFeb 9, 2011
  9. Martin von ZweigbergkFeb 10, 2011
  10. rebase: use @{upstream} if no upstream specifiedMartin von Zweigbergk, Feb 10, 2011
  11. Junio C HamanoFeb 10, 2011
  12. Martin von ZweigbergkFeb 10, 2011

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.