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

Re: {Spam?} push pull not working

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 24, 2012, 20:12 UTC
Message-ID
<7vty3k3lmh.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120124194153.GB19534@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> For example, imagine repo1 has two branches, "master" and "foo", and the
> "master" branch is checked out. When you clone it, the resulting repo2
> will have remote-tracking branches for both "master" and "foo", but will
> only checkout the "master" branch. Now imagine you make commits on
> "foo" in repo1, and then try to push. Git's default behavior is to push
> only branches which match (by name) a branch on the destination. So we
> would attempt to push "master" (which is up to date), but not "foo".

Technically you are not saying anything incorrect, but the above is not an appropriate paragraph to give to a total newbie, I would have to say.

It does not make it clear that it is insane to push to repo2 with matching push (or "current" or "upstream" for that matter), after cloning from a repository repo1 with a working tree to repo2 with an working tree, and making changes at the original repo1 repository. Instead, you are giving a false impression that pushing both "master" and "foo" explicitly would solve the problem OP is having, which is not true.

If repo1 and repo2 with working trees want to criss-cross-exchange their histories, both should "git pull" from the other, not "git push", and if one side cannot initiate a connection to the other, "git push" that goes in the other direction should be pushing into remote tracking refs of the other in order to emulate a "git pull" that goes in the other direction.

Previous: Rick BraggNext: Jeff King
Message 4 of 6 in “{Spam?} push pull not working”
  1. Rick BraggJan 24, 2012
  2. Jeff KingJan 24, 2012
  3. {Spam?} Re: push pull not workingRick Bragg, Jan 24, 2012
  4. Junio C HamanoJan 24, 2012
  5. Jeff KingJan 24, 2012
  6. Junio C HamanoJan 24, 2012

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.