From: Jay Soffian <jaysoffian@gmail.com>
To: "John M. Dlugosz" <ngnr63q02@sneakemail.com>
Cc: git@vger.kernel.org
Subject: Re: setting up tracking on push
Date: Sun, 15 Mar 2009 08:36:31 -0400 [thread overview]
Message-ID: <76718490903150536r2d3e687ckbcc4e1bdb2d2194d@mail.gmail.com> (raw)
In-Reply-To: <4845-91917@sneakemail.com>
On Sat, Mar 14, 2009 at 11:28 PM, John M. Dlugosz
<ngnr63q02@sneakemail.com> wrote:
> Things under refs/remotes are remote tracking branches
Yes.
> and local branches
> (under refs/heads) that automatically updated based on a fetch ("store
> locally" means merge or rebase, right?) are also called remote tracking
> branches.
No. The branches under refs/heads are *not* [1] updated by fetch.
- Anything under refs/remotes is a remote tracking branch.
- Anything under refs/heads is a local branch.
Now, often local branches are based on remote tracking branches, in the
sense that you created the local branch _from_ the remote tracking
branch. So periodically, you will want to update the local branch in
order to incorporate your local changes with whatever changes have been
made in the remote tracking branch. Doing this is a two-step process:
1) You update your remote tracking branches using fetch.
2) You integrate the changes from the remote tracking branches into your
local branches using either merge or rebase.
> I think that's why some of us are confused.
I remember being just as confused, but oddly it seems so clear to me
now. I think there is an inflection point where git goes from
"confusing" to "ah hah, it's ingenious!" :-)
Let me try to draw a little ascii art:
Local Repo Remote Repo (origin)
---------- --------------------
refs/remotes/origin/master <-- fetch --- refs/heads/master
|
(merge or rebase)
|
v
refs/heads/master
As changes are made to refs/heads/master on the remote repo, the
corresponding remote tracking branch on the local repo
(refs/remotes/origin/master) will fall behind. Performing a fetch in the
local repo updates its refs/remotes/origin/master to match the remote's
refs/heads/master. Then either merge or rebase in the local repo, while
refs/heads/master is checked out, integrates those changes.
If no changes have been made locally to refs/heads/master, then the
merge operation is a so-called "fast forward".
The confusing part is that there is a switch to "git checkout" and "git
branch" named "--track". A better name would have probably been
"--follow". Regardless, this switch [2], configures branch.<name>.remote
and branch.<name>.merge in the local repo's .git/config. And I mentioned
in a previous message the reason for having these. [3]
[1] You could of course configure fetch to do whatever you like, but it
would be rather unusual to update refs/heads via fetch.
[2] Which is the default in current git when a local branch is created
from a remote tracking branch.
[3] Namely, 1) branch -v, status, and checkout tell you how far
ahead/behind the local branch is from the remote tracking branch;
2) pull can be run w/o having to explicitly tell it what to fetch
and what to merge.
j.
next prev parent reply other threads:[~2009-03-15 12:38 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-06 3:07 setting up tracking on push Miles Bader
2009-03-06 3:17 ` John Tapsell
2009-03-06 4:49 ` Jay Soffian
2009-03-06 10:45 ` Johannes Schindelin
2009-03-06 11:15 ` Miles Bader
2009-03-06 14:15 ` Jeremy O'Brien
2009-03-06 15:43 ` Jay Soffian
2009-03-06 16:29 ` Miles Bader
2009-03-10 20:26 ` Marc Branchaud
2009-03-10 23:09 ` Jeff King
2009-03-11 1:52 ` Jay Soffian
2009-03-11 2:04 ` Jeff King
2009-03-11 2:59 ` Jay Soffian
2009-03-11 3:06 ` Jeff King
2009-03-11 3:40 ` Jay Soffian
2009-03-11 3:44 ` Jay Soffian
2009-03-11 3:57 ` Jeff King
2009-03-11 4:15 ` Jay Soffian
2009-03-24 9:58 ` Jakub Narebski
2009-03-11 4:37 ` Junio C Hamano
2009-03-11 4:56 ` Miles Bader
2009-03-11 5:03 ` Miles Bader
2009-03-11 5:22 ` Jay Soffian
2009-03-11 21:39 ` Marc Branchaud
2009-03-11 6:32 ` Jeff King
2009-03-11 10:02 ` Nanako Shiraishi
2009-03-11 16:40 ` Jeff King
2009-03-12 0:08 ` John M. Dlugosz
2009-03-12 0:58 ` Jay Soffian
2009-03-12 1:11 ` Junio C Hamano
2009-03-12 1:16 ` Jay Soffian
2009-03-12 1:14 ` Jay Soffian
2009-03-12 1:21 ` Jay Soffian
2009-03-15 3:28 ` John M. Dlugosz
2009-03-15 12:36 ` Jay Soffian [this message]
2009-03-16 1:07 ` John M. Dlugosz
2009-03-16 1:43 ` Jay Soffian
2009-03-15 18:33 ` 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=76718490903150536r2d3e687ckbcc4e1bdb2d2194d@mail.gmail.com \
--to=jaysoffian@gmail.com \
--cc=git@vger.kernel.org \
--cc=ngnr63q02@sneakemail.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).