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

Re: setting up tracking on push

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 11, 2009, 04:37 UTC
Message-ID
<7vwsaw7jzy.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20090311020409.GA31365@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
>   # track origin/master with a different branch
>   git branch --track=origin/master other_branch

Isn't this one confusing with "git branch other_branch origin/master" (I thought --track is the default these days)?

In any case, I find these "branch --retrack" proposals too confusing and probably overengineered.

I need to ask a more fundamental question. Is it really useful for people to be able to re-track arbitrary remote/branch with an existing branch?

The only use case I've heard in this thread and nearby is where you are the one who started the history of the branch, and pushed it into a public repository as a new branch, making the result _the_ most authoritative one. After that, everybody else will be able to have a local branch that tracks the authoritative one with "branch --track frotz origin/frotz", and you will be the only one left unable to do so because you already have that frotz branch.

And for that use case, I find it sensible if we had a way to easily say "This branch hasn't been tracking anything so far (because it is the originator of the history), but now it will give up its authority and start tracking the one it is pushing into", and it would make sense to somehow link that to the invocation of "git push".

    Side note.  I would also accept "It is only one person in the world,
    who can edit .git/config and be done with it; why bother complicate
    the UI for other people" as a valid argument against it, though ;-).

In that "my private branch gave autority to the branch at my public repository" case, it is of course easy to re-clone (or "branch -m" away and then re-fetch) like everybody else, but then you would lose the reflog from the time before the branch went public, so it is not a solution but a poor workaround.

I somehow think it would not make any sense to say "This branch used to track that branch but now it will start tracking this other one". People of course can come up with contrived example to claim it is a useful operation, but in real life, would it really be? "The authoritative repository has moved" is not an example. It would merely be a change in remote.<name>.url. "The upstream renamed the branch" is not an example either. It falls into "Don't do that, then. It will confuse everybody" case.

Previous: Jakub NarebskiNext: Miles Bader
Message 20 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.