git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: "Paolo Ciarrocchi" <paolo.ciarrocchi@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: master and origin
Date: Sun, 29 Oct 2006 22:40:57 +0100	[thread overview]
Message-ID: <200610292240.57443.jnareb@gmail.com> (raw)
In-Reply-To: <4d8e3fd30610291329n7fe59873r87cbee9ccbd4b720@mail.gmail.com>

Paolo Ciarrocchi wrote:
> On 10/29/06, Jakub Narebski <jnareb@gmail.com> wrote:
[...]
>> pull = fetch + merge, so if you pull when you are on your local 'master'
>> branch (and 'master' branch is first in the .git/remotes/origin file I think)
>> you would fetch remote 'master' into local 'origin' and merge what you
>> have in 'origin' into your 'master' (or merge remote 'master' into
>> your local 'master' if you want to think like that).
> 
> So in this case, there is a difference between doing my local
> development under master or myownlocalbranch. Right?
> I mean, if I do my own development under master and I pull, the master
> branch will include origin and my local changes. Corret?
> While if I work in my local branch the datas are not modified with a
> pull, because pull will update only the local copy of the remote
> branch. Correct?

To be more exact (sorry for the confusion) "git pull" means first do
the "git fetch", i.e. update local 'tracking' branches with the contents
of remote branches. For ordinary clone this means:

    remote (origin)  | local
   ------------------+------------------
    master           | origin
    next             | next
    ...              | ...

For --use-separate-remote this means

   remote (origin)   | local
  -------------------+-------------------
   master            | refs/remotes/origin/master
   next              | refs/remotes/origin/next
   ...               | ...

Then it does "merge". It takes the remote branch from first Pull: line in
remotes/origin file, or first in remote.origin.fetch configuration variable,
and merges it with _current_ branch.

So if you always work on local branches, and newer want to merge
automatically, you probably should use "git fetch" for fetching changes.


What is not obvious (and is PITA for first-timers) that to merge
some <sidebranch> into your <branch>, it is simplest to first switch
to <branch> using
  git checkout <branch>
and then merge <sidebranch> using
  git pull . <sidebranch>
(where '.' means local repository).

HTH
-- 
Jakub Narebski

  reply	other threads:[~2006-10-29 21:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-29 20:53 master and origin Paolo Ciarrocchi
2006-10-29 21:01 ` Jakub Narebski
     [not found]   ` <4d8e3fd30610291307v24f5aab8l3f447a1bfdf86ab4@mail.gmail.com>
2006-10-29 21:19     ` Jakub Narebski
2006-10-29 21:29       ` Paolo Ciarrocchi
2006-10-29 21:40         ` Jakub Narebski [this message]
2006-10-29 23:19         ` Luben Tuikov
2006-10-29 22:58 ` Luben Tuikov

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=200610292240.57443.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=paolo.ciarrocchi@gmail.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).