From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Reece Dunn <msclrhd@googlemail.com>
Cc: Junio C Hamano <gitster@pobox.com>, Git List <git@vger.kernel.org>
Subject: Re: Running 'git pull' from an unnamed branch
Date: Mon, 6 Apr 2009 12:03:05 +0200 [thread overview]
Message-ID: <20090406100305.GD20356@atjola.homenet> (raw)
In-Reply-To: <3f4fd2640904060042m438a3a8en2d2746a6216b2b95@mail.gmail.com>
On 2009.04.06 08:42:16 +0100, Reece Dunn wrote:
> 2009/4/6 Junio C Hamano <gitster@pobox.com>:
> > Reece Dunn <msclrhd@googlemail.com> writes:
> >
> >> diff --git a/git-pull.sh b/git-pull.sh
> >> index 8a26763..00a72dd 100755
> >> --- a/git-pull.sh
> >> +++ b/git-pull.sh
> >> @@ -97,6 +97,10 @@ error_on_no_merge_candidates () {
> >> echo "try again (e.g. 'git pull <repository> <refspec>')."
> >> echo "See git-pull(1) for details on the refspec."
> >> echo
> >> + echo "You may not be on a branch. In this case, you need to move"
> >> + echo "onto the branch you want to pull to (usually master):"
> >> + echo " git checkout <branch>"
> >> + echo
> >
> > I do not think that is necessarily what the user wanted to hear. Often I
> > create trial merges on a detached HEAD when I hear a pull-request from
> > others (I have a few work trees that share the repository with my primary
> > working area, made with contrib/workdir/git-new-workdir script, and their
> > HEAD are typically detached at the tip of the master), and in such a use
> > case, the first line of the instruction in the context in your patch is
> > the right thing to give. I do not want to have the resulting trial merge
> > anywhere on my real branches, and do not want to be told to switch to any
> > of them.
> >
> > We really should teach people, especially the new ones early on, that "git
> > push" and "git pull" are meant to be told where-to/from and what, and how
> > to drive these commands with explicit arguments, before letting them rely
> > on the default configuration blindly without understanding the underlying
> > concepts.
>
> Ok, so how about something like:
>
> "You may not be on a branch. Because of this, you need to specify
This should not say "may", either you are or you are not on a detached
HEAD, and git can tell that, so it should not let the user have to
guess.
> where you are pulling from and to. See git-pull(1) for how to do this.
> Alternatively, you can move to a named branch using:
> git checkout <branch>"
Checking out a named branch won't solve the "problem" on its own.
Consider this:
git checkout origin/foo
*do stuff*
git pull
*Oh! I need a named branch*
git checkout -b foo
git pull
*Still fails*
Maybe:
You asked me to pull without telling me which branch you want to merge
with and as you have no branch checked out, I cannot look for any
defaults to use. Please name which branch you want to merge on the
command line and try again (e.g. 'git pull <repository> <refspec>'). See
git-pull(1) for details on the refspec.
That just adjusts the "you can set some defaults" part, replacing it
with a message telling that a detached HEAD cannot have any defaults.
Without implying anything about how the user might want to work, but
giving a hint that a branch can have defaults for "git pull".
Björn
next prev parent reply other threads:[~2009-04-06 10:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-05 21:33 Running 'git pull' from an unnamed branch Reece Dunn
2009-04-05 21:37 ` Sverre Rabbelier
2009-04-05 21:42 ` Markus Heidelberg
2009-04-05 22:15 ` Reece Dunn
2009-04-05 22:28 ` Markus Heidelberg
2009-04-05 22:08 ` Björn Steinbrink
2009-04-05 22:29 ` Reece Dunn
2009-04-06 1:05 ` Junio C Hamano
2009-04-06 7:42 ` Reece Dunn
2009-04-06 10:03 ` Björn Steinbrink [this message]
2009-04-06 12:04 ` Reece Dunn
2009-04-06 21:05 ` Markus Heidelberg
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=20090406100305.GD20356@atjola.homenet \
--to=b.steinbrink@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=msclrhd@googlemail.com \
/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