git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Jon Loeliger <jdl@freescale.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Added a few examples to git-pull man page.
Date: Sat, 05 Nov 2005 01:27:07 -0800	[thread overview]
Message-ID: <7vk6fno36c.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <E1EYDua-00017o-9d@jdl.com> (Jon Loeliger's message of "Fri, 04 Nov 2005 20:36:08 -0600")

Thanks for the documentation updates.  I have one
trouble about this part:

    You never do your own development on branches that appear
    on the right hand side of a <refspec> colon on `Pull:` lines;
    they are to be updated by `git-fetch`.  The corollary is that
    a local branch should be introduced and named on a <refspec>
    right-hand-side if you intend to do development derived from
    that branch.
    This leads to the common `Pull: master:origin` mapping of a
    remote `master` branch to a local `origin` branch, which
    is then merged to a local development branch, again typically
    named `master`.

I am a bit confused by the "corollary".  What happens if you
have the following:

	Pull: master:origin
        Pull: +pu:pu
        Pull: maint:maint

and you say:

	git-pull remote

when you are on your master branch is:

1. master, pu and maint from remote are copied to origin, pu,
   and maint in the local repository (you already know this);

2. the updated origin is merged into the local master (you
   alerady know this too).

If somebody intends to do development derived from say 'maint',
one way to do so would be something like this:

	git checkout -b my-maint maint
	.. work work work, commit commit commit
        .. "git-format-patch maint..my-maint" to send patches
	.. off, or send a pull request to upstream.
        git fetch remote ;# to update origin, pu, and maint.
        git pull . maint ;# merge maint changes into my-maint.

That is, my-maint branch is used for your own development, and
from time to time you fetch remote heads (using remotes/remote
shorthands, the fetch would update origin, pu and maint) to keep
track of the progress of the upstream.  And you merge upstream
'maint' into your development line 'my-maint', when you find
that the upstream have something new in 'maint'.

And because of the rule "you never do your own development on RHS
branch":

	git checkout maint
        .. work work work, commit commit commit
        git pull remote ;# oops

this is discouraged.  'git pull remote' would try to overwrite
the local 'maint' with the remote 'maint', and it would find
that the head would not fast-forward (obviously, since we did
our own work that the remote side does not know about).  But
when I read the "corollary" the first time, it appeared to me
that we are suggesting the above.

Maybe something like this (I know my wording is quite bad and I
would appreciate rephrasing it better very much) would be more
explicit and appropriate?

    If you intend to do development derived from a remote
    branch B, have a `Pull:` line to track it, like this:

        Pull: B:remote-B

    and have a separate branch my-B to do your development
    on top of it.  The latter is created by 'git branch my-B
    remote-B' (or its equivalent, 'git checkout -b my-B
    remote-B'), and that is the branch you make your own
    commits.  Run 'git fetch' to keep track of the progress
    of the remote side, and when you see the tracked remote
    branch has something new, merge it into your development
    branch with 'git pull . remote-B', while you are on my-B
    branch.

  reply	other threads:[~2005-11-05  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-05  2:36 [PATCH] Added a few examples to git-pull man page Jon Loeliger
2005-11-05  9:27 ` Junio C Hamano [this message]
2005-11-05 19:37   ` Josef Weidendorfer

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=7vk6fno36c.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=jdl@freescale.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;
as well as URLs for NNTP newsgroup(s).