[git-users] Multiple clones of the same remote repo

2013-09-02 Thread Juha Aaltonen
Does git get confused if I have multiple clones of the same remote repo?
What I mean is that in one clone I've made commits (and pushes), and the 
other clone hasn't seen them.

I seem to have some problems pulling to the clone that hasn't been used for 
commits/pushes.
On the other hand, the pull reports a lots of conflicts, but fetch says 
it's up todate.

I've been using Windows, and trying out two clients: SourdeTree for the 
other clone (with commits/pushes) and Giteye with the
clone for the pull/fetch problems.

I just wondered if the same username with clones both having and missing 
commits could confuse Git.

-- 
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/groups/opt_out.


Re: [git-users] Multiple clones of the same remote repo

2013-09-02 Thread Konstantin Khomoutov
On Mon, 2 Sep 2013 06:36:08 -0700 (PDT)
Juha Aaltonen turbosc...@gmail.com wrote:

 Does git get confused if I have multiple clones of the same remote
 repo?

No.

The essense of a DVCS system (Git is a DVCS) is that all repositories
are independent and self-contained.  Despite this, in many cases it's
convenient to make a repository possess some extra knowledge of the
other repositories it contacts -- and Git has support for this -- but
this does not create any dependencies between the repositories which
have such knowledge about each other.

Specifically, a repo which has been cloned records no fact this had
happened [1].  Conversely, Git makes every clone know what repository
it has been created from -- this is to ease the common case where you're
likely to contact that same repo again from the clone.  But this
knowledge is very easy to remove completely, and any repository is able
to know about any number of repositories, not just about a single one.

 What I mean is that in one clone I've made commits (and
 pushes), and the other clone hasn't seen them.

It's unclear if you're just stating a fact or are actually wondering
why this happened.  If that took you by surprise then again you have
to clearly understand that all Git repositories are independent from
each other and new commits only ever appear in them at the discretion
of their users -- either when they record new commits or when they fetch
(and possibly merge or rebase).  In other words, to get new data into a
repository you must either create it by yourself (commits) or fetch it
from somewhere else (`git fetch` / `git push`) [2].

 I seem to have some problems pulling to the clone that hasn't been
 used for commits/pushes.
 On the other hand, the pull reports a lots of conflicts, but fetch
 says it's up todate.

This is because `git pull branch` is `git fetch branch` followed
by `git merge tip_commit_on_fetched_branch` which is performed
against the branch which is currently checked out.  So either you have
a wrong branch checked out when doing `git pull` or you have local
modifications, so Git is unable to reconcile these changes with those
it is about to bring in when attempting a merge.

Since you have provided exactly zero information about how exactly it
went wrong, it's hard to judge more precicely.  In a cases like this,
it's best to drop into a shell and perform the necessary commands by
hand: this allows you to just copy-and-paste whay you entered and what
Git output.

[...]
 I just wondered if the same username with clones both having and
 missing commits could confuse Git.

Definitely not.

1. Well, techincally it's possible to script a repository using the
   so-called hooks so that a record of some form is done when another
   Git instance fetches data from this repository.  But this would be a
   a non-standard setup, and Git itself would not be able to make any
   use of this anyway.

2. Again, technically a repo might be armed with special hooks which
   would push changes into another repo after a push happened.
   Certain mirroring schemes are implemented this way.
   But again, this is a non-standard setup (which is also pretty
   complicated to get right).

-- 
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/groups/opt_out.