Re: [Newbie] How to *actually* get rid of remote tracking branch?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Nov 14, 2007, at 2:02 AM, Andreas Ericsson wrote:

BTW, when you have this data-flow (probably typical in a shared
repository workflow):
    Remote repository               Your repository
    refs/heads/foo -------(A)------> refs/remotes/origin/foo
         ^                                |
         |                               (B)
         |                                |
         |                                V
         `-------------(C)---------- refs/heads/foo
         (A) "git fetch" with remote.origin.fetch configuration
             set to +refs/heads/*:refs/remotes/origin/* keeps
             your refs/remotes/origin/foo up-to-date with their
             refs/heads/foo
         (B) "git merge origin/foo" while on "foo" branch (there
             are few shorthands like "git pull origin foo" while
             on "foo" branch.  If you say "git branch --track
             foo origin/foo", then running "git pull" without
             parameter while on "foo" branch).
         (C) "git push origin foo".
 * Everybody seems to agree that "refs/remotes/origin/foo" is
   called a "remote tracking branch";

I'd like to insert the significant dash there. remote-tracking vs
remote tracking. It solves the one ambiguity with it, and would
finally make it clear and consistent almost however it's used.

I recently tried to explain it in the following way:

"refs/remotes/origin/foo" mirrors the original branch (from the
remote repository) in your local repository.  Because it is an
identical copy of the branch in the remote repository it is also
called a "remote-tracking branch" or sometimes just a "remote
branch", although it is stored locally in your repository.


 * Your refs/heads/foo follows and builds on top of 'foo' branch
   at the remote.  Some people errorneously call it "tracking"
   but that is because we do not have a good term for it;

"private tracking branch"? Nah...

"refs/heads/foo" is your local branch that you work
on.  Typically, it's simply called branch foo.  However you
can say "my local branch" foo to emphasis that it's your
branch.  This branch is set up in a way to automatically
merge changes from the remote branch it was created
from.  It is sometimes said to "track" a remote branch,
however it must not be confused with a "remote-tracking
branch".  The terminology used in the documentation is sometimes
confusing.  A clear statement is: "My local branch foo
is configured to automatically merge the remote (tracking)
branch origin/foo, with origin configured to point to
git://server/path/to/repo.git."


 * There is no good name for "refs/heads/foo at the remote".  We
   always say "the remote branch you follow" (or "track").

"remote-repo branch" perhaps? The universe doesn't exactly toll its
bells in approval at that, but at least it's not ambiguous.

Typically, the original branch in the remote repository and
its local remote-tracking branch point to the same commit;
or you can easy update the local copy with fetch.  So, often
they are not distinguished.  But you can say "branch foo
from the remote repository git://server/path/to/repo.git"
is mirrored locally as "remote-tracking branch origin/foo" if
you need to be precise.

If you say "I merged origin/foo" it really does not matter
if you mean the branch in the remote repository or its local
remote-tracking branch.  In both cases the reader needs context
to understand what you exactly mean.  If you want to be precise
here, you can say "I merged commit <sha1>".

A technical note: The '--track' option sets up the local
branch to track the original branch in the remote repository.
The setup is not referring to a local remote-tracking branch
at all.  config.<branch>.merge contains the branch as it is
named in the remote repository.  git is automatically merging
from the branch in the remote repository.  The remote-tracking
branch would not be needed to do this.  So I think it's
not a problem that "remote branch foo" sometimes means the
branch in the remote repository and sometimes means its local
remote-tracking branch.  What you really mean in both cases
is the original branch in the remote repository.  If you want
to explicitly point to a specific commit you need to name it
by other means (sha1) anyway.


I've seen it written as "remote tracking branch" on irc a few times.
It causes 10 minutes of confusion where no-one's sure what anyone
else means. With the dash in there, there's no room for ambiguity.

I believe dash is a good idea.

	Steffen



-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux