Re: [RFC PATCH] push: start warning upcoming default change for push.default

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

 



Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx> wrote:

> lists@xxxxxxxxxxxxxxxx (Stefan Haller) writes:
> 
> > We're a closed-source company that uses git more or less like an
> > old-style, non-distributed VCS.
> > [...]
> > Also, it is very common for two or more developers to collaborate on a
> > topic branch,
> > [...]
> > Topics are never pushed to master; we have a "merge --no-ff" policy for
> > integration.
> > [...]
> > To sum it up, push.default=current is almost perfect for this kind of
> > workflow; except that you still need to configure your upstream branches
> > so that pull works, and status (and the shell prompt) displays the right
> > information.
> 
> What do you set "upstream" to in your flow?

The remote topic branch with the same name.

> I agree that push.default=current is the best setting for you. But I
> think 'tracking' would not be a silly choice either: if you collaborate
> on topic branches, it makes sense to set the upstream to the remote
> topic branch, so that "git pull" gets changes in the same branch (and
> you may need to "git pull origin master" to sync with the master branch
> from time to time). If you create a new branch with, say
> 
>   git checkout -b new-branch
> 
> then the new branch has no upstream configured, and the next push
> without argument will fail, pointing you to the right command for your
> case:
> 
>   $ git push
>   fatal: The current branch new-branch has no upstream branch.
>   To push the current branch and set the remote as upstream, use
>   
>       git push --set-upstream origin new-branch
> 
> If you do a "git checkout new-branch" when "origin/new-branch" exists
> and "new-branch" doesn't, the upstream is configured to point to the
> remote "new-branch".

Yes, you describe exactly what we are doing.  I am having two problems
with this way of working:

1) After creating a new local topic branch, I must remember to use
"push -u origin new-branch" the first time I push it. I don't want to
have to remember whether this is the first time I push; it would be nice
to be able to say "git push" the first time as well.
(push.default=current does this, but it's not good enough because I
still need the upstream branch configured so that pull works.)

2) I get bitten by commands that configure the "wrong" upstream branch
without me realizing it, like "checkout -b topic origin/master". Again,
push.default=current helps somewhat because it avoids accidentally
pushing to the wrong branch; but it will still let me pull from the
wrong branch; and it will confuse me because my shell prompt tells me
I'm ahead of upstream even though I just pushed.


-- 
Stefan Haller
Berlin, Germany
http://www.haller-berlin.de/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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