git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Fetching from peer's public repo

From
Jakub Narebski <jnareb@gmail.com>
Date
Feb 2, 2007, 10:25 UTC
Message-ID
<epv3h5$4f7$1@sea.gmane.org>
In-Reply-To
<17858.1586.41833.597819@lisa.zopyra.com>
Bill Lear wrote:
Show 18 quoted lines
> 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.

[...]
Show 10 quoted lines
> 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
Previous: Bill Lear
Message 3 of 3 in “Fetching from peer's public repo”
  1. Bill LearFeb 1, 2007
  2. Bill LearFeb 1, 2007
  3. Jakub NarebskiFeb 2, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.