RE: git push doesn't use local branch name as default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mathias Kunter wrote:
> Hi all,
> 
> at https://git-scm.com/docs/git-push#_description it says:
> 
> > When neither the command-line nor the configuration specify what to
> > push, the default behavior is used, which corresponds to the simple
> > value for push.default: the current branch is pushed to the
> > corresponding upstream branch, but as a safety measure, the push is
> > aborted if the upstream branch does not have the same name as the local
> > one.
> 
> However, on a branch which does *not* have an upstream branch 
> configured, the command
> 
> > git push <remote_name>
> 
> doesn't use the local branch name as default,

Yes it does, but only on the src side of the refspec. Something like:

  git push <remote_name> <branch_name>:

(invalid refspec)

Note the remote side is missing, so git doesn't know where to push to.

> Note that it *does* work if the remote branch name is explicitly specified:
> 
> > git push <remote_name> <branch_name>

In that case git assumes you mean <branch_name>:<branch_name>.

Sounds like you want to change the default to `push.default=current`.

Cheers.

-- 
Felipe Contreras



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux