Re: push.default: current vs upstream
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Apr 12, 2012, 08:59 UTC
- Message-ID
- <vpqfwc9wckl.fsf@bauges.imag.fr>
- In-Reply-To
- <20120412081407.GE31122@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Then the rule is not really "act only if upstream and current would do > the same thing".
Right. That would be closer to "fail with explicit error when where to push is not clear enough".
Show 5 quoted lines
> On the one hand, I think what you are suggesting is reasonable in most > cases. On the other hand, what if the lack of upstream is because the > user failed to configure it properly? Then it could be surprising. > > I don't have a strong opinion either way.
No strong opinion either, but I wanted to raise the point to make sure we agree.
With your patch, "git push" fails with
fatal: The current branch branch-name has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin branch-nameso it's not really bad: the suggestion guides the user to a situation where the next "git push" will succeed unambiguously. As a side effect, the next "git pull" will fetch from the same branch, which is probably what the user wants if he hasn't explicitely configured an upstream branch yet.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/