git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: setting up tracking on push

From
Jay Soffian <jaysoffian@gmail.com>
Date
Mar 11, 2009, 02:59 UTC
Message-ID
<76718490903101959i61df26aagdff44bb9ab4593ab@mail.gmail.com>
In-Reply-To
<20090311020409.GA31365@coredump.intra.peff.net>
On Tue, Mar 10, 2009 at 10:04 PM, Jeff King <peff@peff.net> wrote:
Show 7 quoted lines
>
>> -u --track [<branch>] <upstream>
>
> Hmm. This seems not quite right to me. Specifically:
>
>  1. Would you ever want to use "-u" without "--track"? If so, then why
>     are they two separate options?

For when branch grows additional long options that update, er, something else. :-)

And you can also use it with --no-track.

But the primary reason for the -u is to differentiate the operation, just like -m and -d.

>  2. In your example, if I give only a single non-option argument, it is
>     interpreted as the upstream (and presumably the branch defaults to
>     HEAD).  But in other branch commands, it is interpreted as the
>     branch, and the upstream defaults to HEAD.
No, look at how -m works. [<oldbranch>] <newbranch>. I modeled it after that.
Show 29 quoted lines
> For (1), you could just have a single option. Unfortunately --track is
> taken. But maybe you could do --track=. And that helps with (2), as
> well, since this syntax would only ever have one or zero arguments. And
> then you can default zero to HEAD.
>
> IOW:
>
>  # track origin/master with the current branch
>  git branch --track=origin/master
>
>  # track origin/master with a different branch
>  git branch --track=origin/master other_branch
>
>  # stop tracking
>  git branch --track=
>
> The only two problems I can think of are:
>
>  1. It is perhaps a little confusing that --track= means "don't do the
>     normal branch operation, but instead do this totally different
>     thing. Of course we already have a similar situation with "-m", but
>     it is perhaps more confusing since "--track" and "--track=" have
>     totally different semantics.
>
>  2. This would be the only branch command to operate on HEAD if given
>     no argument. That isn't necessary for this proposal, but I think it
>     makes it nicer to use. An alternative would be for git-branch to
>     resolve symrefs (which would also be nice for "git branch -m HEAD
>     foo").

Yeah, I like that less than -u, which I agree isn't perfect, but I think it's closer.

j.
Previous: Jeff KingNext: Jeff King
Message 13 of 38 in “setting up tracking on push”
  1. Miles BaderMar 6, 2009
  2. John TapsellMar 6, 2009
  3. Jay SoffianMar 6, 2009
  4. Johannes SchindelinMar 6, 2009
  5. Miles BaderMar 6, 2009
  6. Jeremy O'BrienMar 6, 2009
  7. Jay SoffianMar 6, 2009
  8. Miles BaderMar 6, 2009
  9. Marc BranchaudMar 10, 2009
  10. Jeff KingMar 10, 2009
  11. Jay SoffianMar 11, 2009
  12. Jeff KingMar 11, 2009
  13. Jay SoffianMar 11, 2009
  14. Jeff KingMar 11, 2009
  15. Jay SoffianMar 11, 2009
  16. Jay SoffianMar 11, 2009
  17. Jeff KingMar 11, 2009
  18. Jay SoffianMar 11, 2009
  19. Jakub NarebskiMar 24, 2009
  20. Junio C HamanoMar 11, 2009
  21. Miles BaderMar 11, 2009
  22. Miles BaderMar 11, 2009
  23. Jay SoffianMar 11, 2009
  24. Marc BranchaudMar 11, 2009
  25. Jeff KingMar 11, 2009
  26. Nanako ShiraishiMar 11, 2009
  27. Jeff KingMar 11, 2009
  28. John M. DlugoszMar 12, 2009
  29. Jay SoffianMar 12, 2009
  30. Junio C HamanoMar 12, 2009
  31. Jay SoffianMar 12, 2009
  32. Jay SoffianMar 12, 2009
  33. Jay SoffianMar 12, 2009
  34. John M. DlugoszMar 15, 2009
  35. Jay SoffianMar 15, 2009
  36. John M. DlugoszMar 16, 2009
  37. Jay SoffianMar 16, 2009
  38. Junio C HamanoMar 15, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.