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

[usability bug] git branch -a does not disambiguate remote and local branches

From
CPConstantine Plotnikov <constantine.plotnikov@gmail.com>
Date
Dec 15, 2008, 18:15 UTC
Message-ID
<85647ef50812151015t4d5bc2b8p4ea53a0e4ad25e64@mail.gmail.com>
Let's consider the following scenario:

mkdir bare.git mkdir local cd bare.git git --bare init cd ../local git init echo test > test.txt git add test.txt git commit -m test git remote add origin `pwd`/../bare.git git push --all git checkout -b origin/master master echo updated > test.txt git add test.txt git commit -m updated

Note that that in this scenario, the user has created local branch in the folder with the same name as a remote branch. While the supposed user here is apparently shooting itself in the foot, the scenario is still supported by git, and might happen as a result of more logical git operations (like git fetch).

After this scenario is executed, git branch -a will give the following output:
  master
* origin/master
  origin/master

Note that there is two origin/master entries, but it is not clear which is remote is and which is the local. I think that "git branch -a" should print unambiguous names, qualifying them if needed.

Constantine
Next: Johannes Schindelin
Message 1 of 6 in “[usability bug] git branch -a does not disambiguate remote and local branches”
  1. Constantine PlotnikovDec 15, 2008
  2. Johannes SchindelinDec 15, 2008
  3. Constantine PlotnikovDec 15, 2008
  4. Boyd Stephen Smith Jr.Dec 15, 2008
  5. Lars HjemliDec 15, 2008
  6. Björn SteinbrinkDec 16, 2008

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.