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

Feature request: prevent push -f from pushing all branches at once

From
DDany <nessup@gmail.com>
Date
Jul 3, 2013, 23:30 UTC
Message-ID
<ADE9FE42-FC10-4976-8E6A-290B101DD17A@gmail.com>
Hi,
I had a pretty sucky thing happen to me today: while remote tracking a non-master branch, I force pushed. This had the intended effect of force pushing the branch I was working on, but also the unintended function of force pushing all branches I wasn't on.
I'm open to anyone's thoughts about this (or even a suggestion as to how to avoid this in the future), but as far as I know, in 99% of cases, a developer does not intend to force push all branches he is remote tracking on his system when he types `git push -f`. Now I know that that's what will happen, but I wonder why git does this (and, furthermore, why git doesn't prevent force pushing multiple branches at once.)
Again, I think the case where one intends to force push many branches is certainly not as common as the case where one intends to force push one branch, so why does git's default behavior leave the user in the position of fscking himself over pretty badly?
Would love any thoughts or suggestions on this.

Thanks, --Dany.

Next: Jonathan Nieder
Message 1 of 3 in “Feature request: prevent push -f from pushing all branches at once”
  1. DanyJul 3, 2013
  2. Jonathan NiederJul 3, 2013
  3. Matthieu MoyJul 4, 2013

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.