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:
> Felipe,
> 
> thanks for your reply.
> 
> > Sounds like you want to change the default to `push.default=current`.
> 
> Yes, but shouldn't `simple` pushing also work? The documentation says 
> about `push.default=simple`:
> 
> > When pushing to a remote that is different from the remote you normally
> > pull from, work as `current`.
> 
> If there is no upstream, then there also is no "remote I normally pull 
> from",

If there's no upstream the remote is "origin".

> and thus, according to the doc, `simple` should actually work 
> like `current` in this case. Am I wrong here?

Only if you are not pushing to "origin".

> If `simple` pushing is used, it doesn't seem to make sense for me to 
> fallback to `current` on branches which *do* have an upstream, but to 
> error out on branches which do *not* have an upstream.

That is not the criteria. It depends whether or not you are in a
triangular workflow [1].

If you pull from kernel.org, but push to github.com, then you are in a
triangular workflow and the name of the branch is not checked.

The oposite is a centralized workflow, where you pull and push to the
same repository, then git adds an extra check.

If you don't want to set `push.default`, you can alternatively rename
your remote to something other than "origin", then your branches with no
upstram truly would have nowhere to fetch from.

But then `git fetch` without arguments will not do anything.

Cheers.

[1] https://felipec.wordpress.com/2014/05/11/git-triangular-workflows/

-- 
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