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

Re: [RFD] what should "git push remote.host:path" do?

From
Junio C Hamano <junkio@cox.net>
Date
Jan 12, 2006, 19:00 UTC
Message-ID
<7v64opp8zh.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<BAYC1-PASMTP099ED34B41FFA02EDEEF25AE270@CEZ.ICE>
"Sean" <seanlkml@sympatico.ca> writes:
Show 6 quoted lines
> What about assuming a refspec of  "current-branch:current-branch" ?
> That is, if the branch name that is currently checked out locally
> also exists upstream, push into it (only if fast forward).
>
> This should allow multiple branches to be updated locally, and pushed
> upstream selectively.

Requiring at least one refspec to be given to the command has the same property. Ways to give refspec to the command are:

 (1) give one or more from the command line
 (2) give --all from the command line
 (3) give none from the command line, but in this case you need
     at least one "Push:" the "remotes" file you use.

So it really boils down to "is pushing the current branch a better default"?

Even if a project uses CVS style shared repository setup, individual developers would want to use topic branches to prepare things that they eventually push to the shared common, and I suspect that it would lead to more mistakes if we default the push to push the current branch. "Push: master" in the remotes/ file to publish your results to the shared repository would be safer; "git push" when you are still in your topic branch and have not merged things up into your master branch for publication would be no-op, as opposed to pushing the topic branch, probably resulting in the topic branch in the shared repository, even though the topic was meant to be internal to his repository.

Previous: SeanNext: Nick Hengeveld
Message 3 of 7 in “[RFD] what should "git push remote.host:path" do?”
  1. Junio C HamanoJan 12, 2006
  2. SeanJan 12, 2006
  3. Junio C HamanoJan 12, 2006
  4. Nick HengeveldJan 12, 2006
  5. Linus TorvaldsJan 12, 2006
  6. Junio C HamanoJan 12, 2006
  7. git-push: avoid falling back on pushing "matching" refs.Junio C Hamano, Jan 13, 2006

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.