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

Re: [PATCH 2/2] push: --ignore-stale option

From
Marc Branchaud <marcnarc@xiplink.com>
Date
Dec 15, 2011, 17:47 UTC
Message-ID
<4EEA329F.1020201@xiplink.com>
In-Reply-To
<20111215073816.GD1327@sigill.intra.peff.net>
On 11-12-15 02:38 AM, Jeff King wrote:
Show 26 quoted lines
> 
> But I still see this as solving the wrong problem, and encouraging a
> dangerous workflow. Why are you using ":" to push matching branches if
> you don't want to push topic1? I think a much more likely scenario is:
> 
>   $ git clone <<origin>>
>   $ git checkout -b topic1 origin/topic1
>   $ work work work
>   $ : hmm, it's not ready yet
>   $ git checkout -b topic2 origin/topic2
>   $ work work work
>   $ : looking good, let's ship it!
>   $ git push  ;# we default to matching!
> 
> I.e., the user is not actually intending to push all matching branches,
> but does so accidentally because "matching" is the default. And they
> have accidentally just pushed non-ready work to topic1, which would
> happen even with --ignore-stale.
> 
> IOW, I am not convinced that people are actually consciously choosing
> the workflow you outlined above, and are instead interested in
> --ignore-stale as a convenient way of guessing which branches should be
> pushed during a matching push. But it's only a guess, and as I showed
> above, it can still cause problems. I think the right solution is to
> switch the default away from matching, which is the root cause of the
> confusion.
100% agree.
In my experience, people are confused by any magic that happens when a local
ref name matches a remote's ref name.  I find folks have a much easier time
with git once they embrace the notion that a remote's branches are distinct
from their local clone's, and that explicitly saying
	push origin <local>:<remote>
is the clearest way of making sure git does what you want.

It's convenient for advanced users to take advantage of the shortcuts any ref-matching magic provides, but I find novice users tend to make mistakes as often as not.

		M.
Previous: Jeff KingNext: Junio C Hamano
Message 4 of 11 in “push: --ignore-stale option”
  1. 2/2 push: --ignore-stale optionJunio C Hamano, Dec 13, 2011
  2. Andreas EricssonDec 13, 2011
  3. Jeff KingDec 15, 2011
  4. Marc BranchaudDec 15, 2011
  5. Junio C HamanoDec 15, 2011
  6. Junio C HamanoDec 19, 2011
  7. 1/2 advice: Document that they all default to trueJunio C Hamano, Dec 19, 2011
  8. Jeff KingDec 19, 2011
  9. 2/2 push: hint to use push.default=upstream when appropriateJunio C Hamano, Dec 19, 2011
  10. Jeff KingDec 19, 2011
  11. Junio C HamanoDec 19, 2011

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.