public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Christopher Tiwald <christiwald@gmail•com>
Cc: git@vger•kernel.org, Matthieu.Moy@grenoble-inp•fr, peff@peff•net
Subject: Re: [PATCH] Give better 'pull' advice when pushing non-ff updates to current branch
Date: Mon, 23 Apr 2012 19:17:25 -0700	[thread overview]
Message-ID: <xmqqvckpho0a.fsf@junio.mtv.corp.google.com> (raw)
In-Reply-To: <1335221121-36664-1-git-send-email-christiwald@gmail.com> (Christopher Tiwald's message of "Mon, 23 Apr 2012 18:45:21 -0400")

Christopher Tiwald <christiwald@gmail•com> writes:

> Suppose a user configured a local branch to track an upstream branch by
> a different name or didn't set an upstream branch at all. In these
> cases, issuing 'git pull' without specifying a remote repository or
> refspec can be dangerous. In the first case, 'git pull --rebase' could
> rewrite published history. In the second, 'git pull' without argument
> will fail.

The latter case of stopping without causing damage is hardly dangerous,
so I'll ignore that for now, but I am not sure what you mean by the
former.  A "devel" branch has "master" from "origin" (or whatever
branch.devel.remote is set) as its upstream (i.e. "devel" and "master"
are different strings).  "git pull" will then fetch "master" from the
other side, and either merge that into "devel" or rebuild "devel" on top
of it if you gave "--rebase".

But if you used "master", not "devel", as the name of your local branch,
I do not see anything changes.  You may have published the tip of
"master" to a third repository before doing "pull --rebase", and you may
be rebasing the history leading to that commit.  Even if there is no
third repository, your "master" may be pushed to some other branch of
"origin", so the story is the same.  If your counter-argument is "but
but but I will never ever push my 'master' to names other than 'master'
at 'origin'", then in your original settings where your local branch is
called "devel", you will never ever push you 'devel' to branches other
than 'master' at 'origin', exactly because its upstream is set to
'master'.

So what makes it dangerous is the use of "--rebase", if anything, isn't
it?  It does not seem to have much to do with how the local branches are
named.

  reply	other threads:[~2012-04-24  2:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23 22:45 [PATCH] Give better 'pull' advice when pushing non-ff updates to current branch Christopher Tiwald
2012-04-24  2:17 ` Junio C Hamano [this message]
2012-04-24  4:58   ` Christopher Tiwald
2012-04-24 19:06     ` Junio C Hamano
2012-04-24  2:29 ` Junio C Hamano
2012-04-24  7:04 ` Matthieu Moy
2012-04-24 12:21   ` Christopher Tiwald

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=xmqqvckpho0a.fsf@junio.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Matthieu.Moy@grenoble-inp$(echo .)fr \
    --cc=christiwald@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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