Skip to content
  • Matthieu Moy's avatar
    push: introduce new push.default mode "simple" · b55e6775
    Matthieu Moy authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When calling "git push" without argument, we want to allow Git to do
    something simple to explain and safe. push.default=matching is unsafe
    when used to push to shared repositories, and hard to explain to
    beginners in some contexts. It is debatable whether 'upstream' or
    'current' is the safest or the easiest to explain, so introduce a new
    mode called 'simple' that is the intersection of them: push to the
    upstream branch, but only if it has the same name remotely. If not, give
    an error that suggests the right command to push explicitely to
    'upstream' or 'current'.
    
    A question is whether to allow pushing when no upstream is configured. An
    argument in favor of allowing the push is that it makes the new mode work
    in more cases. On the other hand, refusing to push when no upstream is
    configured encourages the user to set the upstream, which will be
    beneficial on the next pull. Lacking better argument, we chose to deny
    the push, because it will be easier to change in the future if someone
    shows us wrong.
    
    Original-patch-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarMatthieu Moy <Matthieu.Moy@imag.fr>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    b55e6775