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

Re: Please, paint new branch errors in RED (or any visible color)

From
JWJose Wielandt <jose.wielandt@timining.com>
Date
Dec 10, 2021, 19:09 UTC
Message-ID
<CAJrA3nKbUK=_5d5KTCDehrfge4y1aB9YGsFwQYNzUDWGcfog4w@mail.gmail.com>
In-Reply-To
<20211210164249.bahhe5ogjjhz4lxo@fs>

Yes, I git switch has the same behavior. I also agree that add hints could be a good idea.

2021-12-10 13:42 GMT-03:00, Fabian Stelzer <fs@gigacodes.de>:
Show 50 quoted lines
> On 10.12.2021 17:32, Ævar Arnfjörð Bjarmason wrote:
>>
>>On Fri, Dec 10 2021, Jose Wielandt wrote:
>>
>>> Hi community,
>>>
>>> At my work we've been struggling a lot with not realizing that our new
>>> branch creation actually failed, ending up with a push directly to
>>> develop. What are those cases?
>>>
>>> $ git checkout -b feature/solve p-eq-np
>>> fatal: Cannot update paths and switch to branch 'feature/solve' at the
>>> same time.
>>>
>>> What's my proposal?
>>>
>>> $ git checkout -b feature/solve p-eq-np
>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>
>>> FATAL: CANNOT UPDATE PATHS AND SWITCH TO BRANCH 'feature/solve' AT THE
>>> SAME TIME
>>>
>>>                  YOU STILL IN THE SAME BRANCH ! ! ! !
>>>
>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>
>>> ***(but in bright RED)***
>>>
>>>
>>> Another case!
>>>
>>> $ git branch feature/solve p-eq-np
>>> fatal: Not a valid object name: 'p-eq-np'.
>>>
>>> I'll let that one to your imagination but please, make it appear in
>>> red so we can easily (visually) realize that something went wrong.
>>>
>>>
>>> This has been the third time in a month we accidentally pushed changes
>>> to develop bc we didn't realize that the command failed.
>>
>>I think if we'd improve the output we'd probably add some "advice"
>>output, i.e. "hint:" lines, not ALL CAPS.
>>
>
> Adding some color for die/error/warning() in general if we detect a tty
> might not a bad thing. I have encountered similar situations where an error
>
> gets lost in between `git log` output.
>
Previous: Fabian StelzerNext: Ævar Arnfjörð Bjarmason
Message 4 of 8 in “Please, paint new branch errors in RED (or any visible color)”
  1. Jose WielandtDec 10, 2021
  2. Ævar Arnfjörð BjarmasonDec 10, 2021
  3. Fabian StelzerDec 10, 2021
  4. Jose WielandtDec 10, 2021
  5. Ævar Arnfjörð BjarmasonDec 11, 2021
  6. Junio C HamanoDec 12, 2021
  7. Ævar Arnfjörð BjarmasonDec 12, 2021
  8. Eric SunshineDec 12, 2021

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.