Re: Using the --track option when creating a branch
From: Andreas Ericsson <hidden>
Date: 2016-06-15 22:45:33
Bill Lear wrote:
On Thursday, October 30, 2008 at 06:04:54 (-0600) Bill Lear writes:quoted
On Wednesday, October 29, 2008 at 22:12:18 (-0700) Sam Vilain writes:quoted
On Wed, 2008-10-29 at 09:23 -0600, Bill Lear wrote:quoted
We use git in a way that makes it desirable for us to only push/pull to the same remote branch. So, if I'm in branch X, I want 'git push' to push to origin/X, and 'git pull' to fetch into origin/X and then merge into X from origin/X. In other words, we want git push/pull to behave in branches other than master the same way it does when in master. I have discovered the '--track' option when creating a local branch, and this appears to me to be the thing that gives us the desired behavior.As things currently stand this is not achievable behaviour. The behaviour of 'git push' is to push all matching refs. If you are lucky this is what you intended, but it also pushes any changes to *other* branches that you have made. I have tabled a change proposal to make it work as you suggest in a separate thread.Ok, now I'm confused. The ONLY thing I want to prevent is the "crossing of streams" issue. If I am on branch X and issue 'git push', I want X, and ONLY X, to be pushed to the remote repository's X branch --- I don't care if other branches are pushed to their respective remote branches, as long as they don't get merged to X.Oh, and also the same thing for 'git pull' --- sorry to leave that out.
This particular bikeshed was painted a long time ago, with the consensus going in favour of "git push" pushing all *matching* refspecs. To convince people, I think you need to either come up with arguments nullifying all the arguments *for* pushing all matching refspecs along with patches to make the default configurable, with your preferred way as a default, and a nifty enough shorthand for pushing/fetching all matching refspecs. For preference, they should be at least 3 separate patches. -- Andreas Ericsson andreas.ericsson@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231