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

Re: [PATCH 1/3] git-branch: add --track and --no-track options

From
Junio C Hamano <junkio@cox.net>
Date
Mar 6, 2007, 06:45 UTC
Message-ID
<7vejo2uaxs.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<esgm1m$33f$1@sea.gmane.org>
Paolo Bonzini <bonzini@gnu.org> writes:
Show 15 quoted lines
> In order to track and build on top of a branch 'topic' you track from
> your upstream repository, you often would end up doing this sequence:
>
>   git checkout -b mytopic origin/topic
>   git config --add branch.mytopic.remote origin
>   git config --add branch.mytopic.merge refs/heads/topic
>
> This would first fork your own 'mytopic' branch from the 'topic'
> branch you track from the 'origin' repository; then it would set up two
> configuration variables so that 'git pull' without parameters does the
> right thing while you are on your own 'mytopic' branch.
>
> This commit adds a --track option to git-branch, so that "git
> branch --track topic origin/topic" performs the latter two actions
> when creating your 'topic' branch.

Hmm. I think your use of 'mytopic' is very good for the purpose of illustration. It makes clear which configuration takes name from what. So I like your first paragraph. However, one reason people like the separate remote layout is that it allows you to name your own branch identically with that of the other side, so in that sense, the description in your second paragraph matches the real-life usage better. What I am getting at is that (1) these two paragraphs are inconsistent, (2) there is a reason to prefer the description in the first paragraph, and (3) there is another reason to prefer the description in the second one.

Show 5 quoted lines
> By setting configuration variable
> 'remote.REMOTENAME.trackintolocalbranches' to true, you do not have to
> pass the --track option explicitly (the configuration variable is off
> by default, and there is a --no-track option to countermand it even if
> the variable is set).

As Johannes already pointed this out, I think allowing this to be controlled per remote is nice but overkill. A single boolean configuration, say "branch.autosetupmerge", would suffice.

Previous: Johannes SchindelinNext: Paolo Bonzini
Message 16 of 20 in “git-branch: add --track and --no-track options”
  1. 1/3 git-branch: add --track and --no-track optionsPaolo Bonzini, Mar 5, 2007
  2. Johannes SchindelinMar 5, 2007
  3. Paolo BonziniMar 5, 2007
  4. Johannes SchindelinMar 5, 2007
  5. Paolo BonziniMar 5, 2007
  6. Paolo BonziniMar 5, 2007
  7. Johannes SchindelinMar 5, 2007
  8. Paolo BonziniMar 5, 2007
  9. Johannes SchindelinMar 5, 2007
  10. Paolo BonziniMar 5, 2007
  11. Johannes SchindelinMar 5, 2007
  12. Paolo BonziniMar 5, 2007
  13. Junio C HamanoMar 5, 2007
  14. Paolo BonziniMar 6, 2007
  15. Johannes SchindelinMar 5, 2007
  16. Junio C HamanoMar 6, 2007
  17. Paolo BonziniMar 6, 2007
  18. Junio C HamanoMar 6, 2007
  19. Paolo BonziniMar 6, 2007
  20. Junio C HamanoMar 6, 2007

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.