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

Re: {Spam?} push pull not working

From
Jeff King <peff@peff.net>
Date
Jan 24, 2012, 20:18 UTC
Message-ID
<20120124201807.GA20145@sigill.intra.peff.net>
In-Reply-To
<7vty3k3lmh.fsf@alter.siamese.dyndns.org>
On Tue, Jan 24, 2012 at 12:12:54PM -0800, Junio C Hamano wrote:
Show 11 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.
> [...]

Yeah, I agree with all of this. I was trying not to go into too much detail because we knew so little about the situation (e.g., we don't even know if repo2 in the example is bare or not!), but perhaps my terseness made things even more confusing.

This might have been a better example (it exhibits the problem, but is not an example of a terrible thing to be doing):

  1. repo1 has a "master" branch
  2. clone repo1 with "git clone --bare repo1 repo2". Repo2 now has a
     master branch.
  3. create a new "foo" branch in repo and commit on it
  4. "git push ../repo2" from repo1. This is a sane thing to be doing,
     but will not push the newly-created "foo" branch, as some users
     might expect.
-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 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.