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

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

 



Elijah Newren wrote:
> > If there is no upstream, then there also is no "remote I normally pull
> > from", and thus, according to the doc, `simple` should actually work
> > like `current` in this case. Am I wrong here?
> 
> The relevant code is
> 
>     return (fetch_remote && fetch_remote != remote);
> 
> so you only get the "current" behavior when fetch_remote is non-NULL.

fetch_remote is practically never non-NULL.

fetch_remote is remote_get(NULL), which is basically the equivalent of:

remote_get(remote_for_branch(current_branch, ...));

Typically when an upstream branch is not configured, this is the same
as:

remote_get("origin");

The only time fetch_remote is NULL is when the configured remote is
invalid.

So you don't get the "current" behavior when pushing to "origin".

Perhaps:

--- a/Documentation/config/push.txt
+++ b/Documentation/config/push.txt
@@ -29,8 +29,8 @@ push.default::
   different from the local one.
 +
 When pushing to a remote that is different from the remote you normally
-pull from, work as `current`.  This is the safest option and is suited
-for beginners.
+pull from (typically "origin"), work as `current`.  This is the safest option
+and is suited for beginners.
 +
 This mode has become the default in Git 2.0.

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