git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Carlos Martín Nieto" <cmn@elego.de>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: git@vger.kernel.org
Subject: Re: [RFC/PATCH] Make git-{pull,rebase} no-tracking message friendlier
Date: Wed, 29 Feb 2012 04:57:34 +0100	[thread overview]
Message-ID: <1330487854.691.24.camel@centaur.lab.cmartin.tk> (raw)
In-Reply-To: <vpq399wc4ns.fsf@bauges.imag.fr>

On Mon, 2012-02-27 at 23:06 +0100, Matthieu Moy wrote:
> Carlos Martín Nieto <cmn@elego.de> writes:
> 
> > -		echo "You asked me to $cmd without telling me which branch you
> > -want to $op_type $op_prep, 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
> > +		echo "You asked me to $cmd without telling me which branch you want to
> > +$op_type $op_prep, and there is no tracking information for the current branch.
> > +Please specify which branch you want to use on the command line and
> >  try again (e.g. '$example').
> 
> At this point, it may be better to actually give the full command
> instead of just this "(e.g. '$example')", i.e. stg like
> 
>   git $op_type <remote> $example
> 
> I also saw users confused by the message (indeed without reading it,
> but ...). Giving them something as close as possible to
> cut-and-paste-able command should help.


$example is a caller-given string which already contains the whole
command (i.e. it's already 'git rebase <upstream branch>' or 'git pull
<repository> <branch>').  In this patch I've moved that command to its
own paragraph so the usage part of the output gets more visibility.

Another version of the patch, this one somewhat more intrusive,
hopefully easier to digest.

---8<---
Subject: [PATCH] Make git-{pull,rebase} message without tracking information
 friendlier

The current message is too long and at too low a level for anybody to
understand it if they don't know about the configuration format
already.

Reformat it to show the commands a user would be expected to use,
instead of the contents of the configuration file. Use <branch>
instead of <refspec> or <upstream branch> as they're bound to consfuse
new users more than help them. Use <remote> instead of <repository> in
the pull message.
---
 git-parse-remote.sh |   26 ++++++++++----------------
 git-pull.sh         |    2 +-
 git-rebase.sh       |    2 +-
 3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index b24119d..bcb75a0 100644
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -66,25 +66,19 @@ line and try again (e.g. '$example').
 See git-${cmd}(1) for details."
 	else
 		echo "You asked me to $cmd without telling me which branch you
-want to $op_type $op_prep, 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. '$example').
-See git-${cmd}(1) for details.
+want to $op_type $op_prep, and the current branch doesn't have
+tracking information. Please specify which branch you want to
+use on the command line and try again. See git-${cmd}(1) for details.
+
+    $example
 
 If you often $op_type $op_prep the same branch, you may want to
-use something like the following in your configuration file:
-    [branch \"${branch_name#refs/heads/}\"]
-    remote = <nickname>
-    merge = <remote-ref>"
-		test rebase = "$op_type" &&
-		echo "    rebase = true"
-		echo "
-    [remote \"<nickname>\"]
-    url = <url>
-    fetch = <refspec>
+run something like:
 
-See git-config(1) for details."
+    git remote add <remote> <url>
+    git branch --set-upstream ${branch_name#refs/heads/} <remote>/<branch>"
+		test rebase = "$op_type" &&
+		echo "    git config branch.${branch_name#refs/heads/}.rebase true"
 	fi
 	exit 1
 }
diff --git a/git-pull.sh b/git-pull.sh
index d8b64d7..309c7db 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -176,7 +176,7 @@ error_on_no_merge_candidates () {
 	elif [ -z "$curr_branch" -o -z "$upstream" ]; then
 		. git-parse-remote
 		error_on_missing_default_upstream "pull" $op_type $op_prep \
-			"git pull <repository> <refspec>"
+			"git pull <remote> <branch>"
 	else
 		echo "Your configuration specifies to $op_type $op_prep the ref '${upstream#refs/heads/}'"
 		echo "from the remote, but no such ref was fetched."
diff --git a/git-rebase.sh b/git-rebase.sh
index 00ca7b9..69c1374 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -380,7 +380,7 @@ then
 		then
 			. git-parse-remote
 			error_on_missing_default_upstream "rebase" "rebase" \
-				"against" "git rebase <upstream branch>"
+				"against" "git rebase <branch>"
 		fi
 		;;
 	*)	upstream_name="$1"
-- 
1.7.9.2.3.g4346f

  reply	other threads:[~2012-02-29  3:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23 16:05 [RFC/PATCH] Make git-{pull,rebase} no-tracking message friendlier Carlos Martín Nieto
2012-02-23 20:28 ` Junio C Hamano
2012-02-27 17:07   ` Carlos Martín Nieto
2012-02-27 22:06 ` Matthieu Moy
2012-02-29  3:57   ` Carlos Martín Nieto [this message]
2012-02-29  8:09     ` Matthieu Moy
2012-02-29 17:34       ` Carlos Martín Nieto
2012-02-29 18:41       ` [PATCH] Make git-{pull,rebase} message without tracking information friendlier Carlos Martín Nieto
2012-02-29 20:14         ` Junio C Hamano
2012-03-04  4:41           ` Carlos Martín Nieto
2012-03-05  7:49             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330487854.691.24.camel@centaur.lab.cmartin.tk \
    --to=cmn@elego.de \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).