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

Re: Output of git checkout goes to stderr

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 30, 2024, 07:36 UTC
Message-ID
<CAPig+cTGhzZom+27WEHFbij-_MdFL+tNQ0uQZ3wskB1v10fHVg@mail.gmail.com>
In-Reply-To
<CAFGW38fkr+OuhpcyqNFxZNkhNDGPxTbOmCJLVHpCGUmbj05tMg@mail.gmail.com>

On Tue, Jul 30, 2024 at 1:44 AM Sayooj Surendran <sayooj.surendran@bigbinary.com> wrote:

> Noticed that the output of git checkout command is going to stderr
> channel. Is this an intended behaviour?
Yes, it is intentional. Git's Documentation/CodingGuidelines has this to say:

--- >8 --- Program Output

 We make a distinction between a Git command's primary output and
 output which is merely chatty feedback (for instance, status
 messages, running transcript, or progress display), as well as error
 messages. Roughly speaking, a Git command's primary output is that
 which one might want to capture to a file or send down a pipe; its
 chatty output should not interfere with these use-cases.
 As such, primary output should be sent to the standard output stream
 (stdout), and chatty output should be sent to the standard error
 stream (stderr). Examples of commands which produce primary output
 include `git log`, `git show`, and `git branch --list` which generate
 output on the stdout stream.
 Not all Git commands have primary output; this is often true of
 commands whose main function is to perform an action. Some action
 commands are silent, whereas others are chatty. An example of a
 chatty action commands is `git clone` with its "Cloning into
 '<path>'..." and "Checking connectivity..." status messages which it
 sends to the stderr stream.
 Error messages from Git commands should always be sent to the stderr
 stream.
--- >8 ---
Previous: Sayooj SurendranNext: Karthik Nayak
Message 2 of 4 in “Output of git checkout goes to stderr”
  1. Sayooj SurendranJul 30, 2024
  2. Eric SunshineJul 30, 2024
  3. Karthik NayakJul 30, 2024
  4. Junio C HamanoJul 30, 2024

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.