On Tue, 21 Jul 2015 23:00:23 -0700 (PDT)
dexter ietf <dexter.i...@gmail.com> wrote:

> Does it work even if the original cloned branch is off of (P),
> i'm just trying to understand how and why this can work.
> 
> (Ma) is Machine A
> (Mb) is Machine B
> 
> (P) - parent branch
> 
> Ma - clone P, call it Pa
>      - create private branch Pva in the same tree,  i want to set the 
> remote as (Pb)
> 
> Mb - Clone P, call it Pb
> 
> I'm just trying to understand if the above is valid configuration ?
> thanks a lot for your help.

I'm afraid you might have terminological issues here: you can't clone
branches, you can only clone entire repositories (containing branches).

As to whether a branch might track any other *arbitrary* branch -- the
answer is yes.  Git, on purpose, pays absolutely no attention to the
source of the information it manages: the only think it's concerned
with is object names (those string representations of SHA-1 hash
values).  So you might obtain a branch X from a repository A, fork a
local branch L off it and then set your L to track arbitrary branch Y
fetched from a repository B.  X and Y might be the same (in terms of
their history) or may be completely different -- Git does not care;
just in the latter case `git status` et al will tell you your L and Y
are heavily diverged because they contain unrelated disjoint histories.

To understand how Git "knows" whether two branches are related in terms
of their histories, and how much they are diverged is easy: to get this
information Git uses the same technique as the `git merge-base` command
does, so consider reading its manual page.

As to "tracking" a branch by another branch, this information is purely
declarative and amounts to a single entry in the .git/config file,
which you will easily be able to locate.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to