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

Minor bug in git branch --set-upstream-to adding superfluous branch section to config

From
PHPhil Haack <haacked@gmail.com>
Date
Mar 29, 2013, 16:29 UTC
Message-ID
<CAD7mMPW=jr6PaAc50h-Wpf42-UPrn0A5KmisqXNXqqLv78AEgg@mail.gmail.com>
Hello there! Please /cc me with responses as I'm not on the mailing list.

I'm using git version 1.8.1.msysgit.1 and I ran into a very minor issue. It doesn't actually seem to affect operations, but I thought I'd report it in case someone felt it was worth cleaning up.

If you run the following set of commands:
    git checkout -b some-branch
    git push origin some-branch
    git branch --set-upstream-to origin/some-branch
    git branch --unset-upstream some-branch
    git branch --set-upstream-to origin/some-branch
You get the following result in the .git\config file
    [branch "some-branch"]
    [branch "some-branch"]
        remote = origin
        merge = refs/heads/some-branch

My expectation is that the very last call to: git branch --set-upstream-to would not add a new config section, but would instead insert this information into the existing [branch "some-branch"].

In any case, from what I understand the current behavior is technically valid and I haven't encountered any adverse effects. It was just something I noticed while testing.

Thanks!
Next: Jeff King
Message 1 of 13 in “Minor bug in git branch --set-upstream-to adding superfluous branch section to config”
  1. Phil HaackMar 29, 2013
  2. Jeff KingMar 29, 2013
  3. Thomas RastMar 29, 2013
  4. Jeff KingMar 29, 2013
  5. t1300: document some aesthetic failures of the config editorJeff King, Mar 29, 2013
  6. Junio C HamanoMar 29, 2013
  7. Jeff KingMar 29, 2013
  8. Junio C HamanoMar 29, 2013
  9. Jeff KingMar 30, 2013
  10. Johannes SchindelinMar 28, 2018
  11. Jeff KingMar 28, 2018
  12. Junio C HamanoMar 29, 2013
  13. Junio C HamanoMar 29, 2013

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.