Re: git-push branch confusion caused by user mistake
- Date: Fri, 10 Mar 2017 14:13:10 -0800
- From: Junio C Hamano <gitster@xxxxxxxxx>
- Subject: Re: git-push branch confusion caused by user mistake
Phil Hord <phil.hord@xxxxxxxxx> writes:
> I think git should be smarter about deducing the dest ref from the
> source ref if the source ref is in refs/remotes, but I'm not sure how
> far to take it.
My knee-jerk reaction is "Don't take it anywhere".
Giving a refspec from the command line is an established way to
defeat the default behaviour when you do not give any and only the
remote, and making it do things behind user's back, you would be
robbing the escape hatch from people.
It often is useful in real-life workflow when "git push $dest
origin/master" does exactly the way it works now, which I actually
use myself. Imagine that you have two repositories, use one of them
primarily to interact with the outside world and do your work, but
you then occasionally push from that primary repository to the other
one, instead of logging into the host that has the other one and
running a fetch on that host from the outside world. Your "trying
to be clever when given a colon-less refspec" will force people to
type "git push $dest origin/master:origin/master" in such a case.