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

Re: git push in --tracked branches.

From
Jeff King <peff@peff.net>
Date
Apr 22, 2010, 01:52 UTC
Message-ID
<20100422015251.GA25093@coredump.intra.peff.net>
In-Reply-To
<i2n3abd05a91004211813t8111c77am381bc0b8226a0c9b@mail.gmail.com>
On Wed, Apr 21, 2010 at 09:13:14PM -0400, Aghiles wrote:
Show 9 quoted lines
> On Wed, Apr 21, 2010, Jeff King <peff@peff.net> wrote:
> 
> > "git push" will by default push matching refs. This has been the
> > behavior since day one. See the description of push.default in "git help
> > config" for other options (I think you want "tracking").
> 
> Thank you very much. The 'tracking' case is what I need. Could you
> enlighten me why pushing all matching branches is a sensible default ?
> It seems like an unusual thing to do.

I think it comes from a workflow where you tend to have a private repo and then a personal public repo for publishing. The matching refs are then the set of refs that you have previously pushed. So you do:

  $ git push public foo ;# publish "foo" for the first time
  $ git push public ;# now "foo" will be published every time

And you probably do work on topic branches, and only merge them into your public branches when they are ready to show the world. So push is really about synchronizing those public branches.

If you are working by cloning from a collaborative central repository, then that workflow doesn't make as much sense. The refs on the other end are not about "things I have published before" but rather "the set of all refs that our group agrees about". And probably your workflow is to hack on a specific ref, and then push changes to that ref.

Git grew out of the first type of workflow, and that has always been the default. Tools for helping the latter workflow have developed later. There was some discussion about changing the default, but it hurts people used to the current default, so we ended up with the config variable.

That is just my two cents, though. I have largely stayed out of the debates which seem to come up every once in a while. I think this thread is the one that lead to push.default:

  http://article.gmane.org/gmane.comp.version-control.git/111375
-Peff
Previous: AghilesNext: Aghiles
Message 4 of 5 in “git push in --tracked branches.”
  1. AghilesApr 22, 2010
  2. Jeff KingApr 22, 2010
  3. AghilesApr 22, 2010
  4. Jeff KingApr 22, 2010
  5. AghilesApr 22, 2010

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.