git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Dany <nessup@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Feature request: prevent push -f from pushing all branches at once
Date: Wed, 3 Jul 2013 16:38:04 -0700	[thread overview]
Message-ID: <20130703233804.GW408@google.com> (raw)
In-Reply-To: <ADE9FE42-FC10-4976-8E6A-290B101DD17A@gmail.com>

Hi Dany,

Dany wrote:

> 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.

Yeah, I agree that this is lousy.

When you run "git push" or "git push -f" without further arguments,
current versions of git print a long message:

| $ git push
| warning: push.default is unset; its implicit value is changing in
| Git 2.0 from 'matching' to 'simple'. To squelch this message
| and maintain the current behavior after the default changes, use:
| 
|   git config --global push.default matching
| 
| To squelch this message and adopt the new behavior now, use:
| 
|   git config --global push.default simple
| 
| See 'git help config' and search for 'push.default' for further information.
| (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
| 'current' instead of 'simple' if you sometimes use older versions of Git)

This is intended as a warning that git is not necessarily going to
push the branches that you intended, with instructions for teaching
git what you actually meant.  For historical reasons (to support
habits and scripts) the current default is the "push matching
branches" behavior you ran into, but in the future the default will be
a more conservative "push the current branch, and only if it is
configured to pull from the matching branch", allowing this long
message to go away.

What version of git are you using?  Any ideas about how that message
could be improved?  (Perhaps it is too long to work as an effective
warning.)

Thanks and hope that helps,
Jonathan

  reply	other threads:[~2013-07-03 23:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-03 23:30 Feature request: prevent push -f from pushing all branches at once Dany
2013-07-03 23:38 ` Jonathan Nieder [this message]
2013-07-04  8:06 ` Matthieu Moy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130703233804.GW408@google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=nessup@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).