Re: Fetching from peer's public repo

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

 



Bill Lear wrote:

> My fetch from a peer's public repo seems to be failing:
> 
> % git --bare fetch git://source/public/project topic:topic
> remote: Generating pack...
> remote: Done counting 48 objects.
> remote: Result has 34 objects.
> remote: Deltifying 34 objects.
> remote:  100% (34/34) done
> remote: Total 34, written 34 (delta 22), reused 24 (delta 12)
> Unpacking 34 objects
>  100% (34/34) done
> * refs/heads/topic: not updating to non-fast forward branch 'topic' of git://source/public/project
>   old...new: 1c332f5...f3b18ff
> 
> I assume that is because his public repo does not contain changes I
> have pushed into my public repo.  So, I asked him to pull from
> my public repo into his.  He did, and said that git blathered that
> there were 12 changed files, etc.

First, git did good and protected you from losing your changes which
were in "your public repo" but not in "his public repo" (well, not exacly
lose, as you can very easy revert fetch thanks to ORIG_HEAD and reflog
if you have it enabled).

Second, if you know what you are doing, for example if you know that
topic branch was rebased (has it's history changed), so you know that
non-fast forward case is not an error, you can use euther "+topic:topic"
refspec, or use --force option to git-fetch.

Third, you do not pull into bare repo: you fetch into bare repository.
But, fourth, it looks like he has some changes and you have some changes;
unless you want to have those changes in separate branches, you have to
merge your and his changes; or he has to merge your and his changes
(but in working repo, i.e. with working directory, not a bare one, as
merge might result in conflicts) using git-pull.

Fifth, this situation is what tracking branches are for: you fetch
his from his working branch changes into tracking branch and merge
into your working branch when you want; he fetches your changes
from your working branch into tracking branch and merge your changes
into his working branch when he wants.

[...]
> Also, what is the difference between:
> 
> % git log 1c332f5..f3b18ff
> 
> and
> 
> % git log 1c332f5...f3b18ff
> 
> with the latter having three dots instead of two?  It seems to show
> much more output, but I don't know what the intent is.

"git log 1c332f5..f3b18ff" is equivalent to "git log f3b18ff --not 1c332f5"
which means whowing all changes reachable from f3b18ff but which are not
reachable from 1c332f5, which result in all changes from 1c332f5 (non
inclusive) to f3b18ff (inclusive).

"git log 1c332f5...f3b18ff" is equivalent to
  git log 1c332f5 f3b18ff --not $(git merge-base --all 1c332f5 f3b18ff)
which result in all changes which are either in 1c332f5 xor in f3b18ff,
but not in both.

git 1.5.0 would have --left-right option to mark which side (1c332f5 or
f3b18ff) revisions in 1c332f5...f3b18ff belong to.


P.S. RTFM.

git-log(1):
       The command takes options applicable to the git-rev-list(1) command to con-
       trol what is shown and how

git-rev-list(1):
       Another  special  notation  is  "<commit1>...<commit2>" which is useful for
       merges. The resulting set of commits is the  symmetric  difference  between
       the two operands. The following two commands are equivalent:

               $ git-rev-list A B --not $(git-merge-base --all A B)
               $ git-rev-list A...B
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


-
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]