Re: setting up tracking on push
- From
Jeff King <peff@peff.net>
- Date
- Mar 10, 2009, 23:09 UTC
- Message-ID
- <20090310230939.GB14083@sigio.peff.net>
- In-Reply-To
- <49B6CCDB.8010305@xiplink.com>
On Tue, Mar 10, 2009 at 04:26:03PM -0400, Marc Branchaud wrote:
> It would be good if the branch command allowed modification of a > branch's properties. At the very least, branch-creation commands like > "git branch --track foobranch origin/master" could offer to modify if > the branch already exists, instead of just quitting.
I agree that it would be nice if an interface could be made around "branch --track". However, the problem with
git branch --track foobranch origin/master
is that it does two things: it sets up tracking, and it resets the foobranch ref. Right now we complain if foobranch already exists. We have a "-f" to override. But what you want to say is "set foobranch to track origin/master, but _don't_ actually reset where it points". And I don't see an intuitive way of doing that with that syntax. If you don't require "-f", then you are silently ignoring half of what the user asked you to do.
> BTW, I think the following (untested) incantation adds tracking to a branch: > > git config branch.foobranch.remote origin > git config branch.foobranch.merge refs/heads/master
Yes, that is right. The only reason it is not a two-line script to convert "git branch --track" into that is that you have to actually resolve origin/master into "remote origin, branch refs/heads/master".
-Peff