Re: [PATCH 5/8] push, send-pack: support pushing HEAD to real ref name
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:45
Steffen Prohaska [off-list ref] writes:
On Oct 28, 2007, at 5:03 PM, Junio C Hamano wrote: ...quoted
An alternative, just to let me keep my nicer public image by pretending to be constructive ;-) Introduce a configuration "remote.$name.push_default" whose value can be a list of refs. Teach the push command without refspecs: $ git push $ git push $remote to pretend as if the listed refspecs are given, instead of the traditional "matching branches" behaviour. Then, introduce another option $ git push --matching $ git push --matching $remote to override that configuration, if set, so that the user who usually pushes only the selected branches can use the "matching branches" behaviour when needed. Along with your earlier "git push $remote HEAD" patch, this will allow you to say: [remote "origin"] push_default = HEAD and your $ git push will push only the current branch.Sounds reasonable; but it is more work. I'm not starting to implement this today.
Take your time; nobody is in a hurry. If somebody usually uses "matching" behaviour, i.e. without remote.$name.push_default configuration, but wants to push only the current branch as a one-shot operation, we can obviously use "git push $remote HEAD". But to be complete, it may make sense to have another option $ git push --current that lets you omit $remote (and default to the value configured with branch.$name.remote).