# git worktree add prints to stdout

3 messages from 2018-08-05 to 2018-08-05. Participants: Karen Arutyunov, Thomas Gummerer, Jonathan Nieder.
Thread: https://gitlist.dev/t/49040

## Karen Arutyunov, 2018-08-05 13:01

Subject: git worktree add prints to stdout
Message-ID: <631ae70d-9b5f-613d-5b6f-5064d548a894@codesynthesis.com>
URL: https://gitlist.dev/e/631ae70d-9b5f-613d-5b6f-5064d548a894%40codesynthesis.com

```
Hello,

The 'git worktree add' command prints to both standard streams. So in 
the following example the first line is printed to stderr and the second 
to stdout.

$ git worktree add ../pub build2-control
Preparing ../pub (identifier pub)
HEAD is now at b03ea86 Update

This looks like a bug, as, for example, the checkout command prints 
'HEAD is now at...' message to stderr.

Best regards,
Karen

```

## Thomas Gummerer, 2018-08-05 14:52

Subject: Re: git worktree add prints to stdout
Message-ID: <20180805145254.GF2734@hank.intra.tgummerer.com>
URL: https://gitlist.dev/e/20180805145254.GF2734%40hank.intra.tgummerer.com
In-Reply-To: <631ae70d-9b5f-613d-5b6f-5064d548a894@codesynthesis.com>

```
On 08/05, Karen Arutyunov wrote:
> Hello,
> 
> The 'git worktree add' command prints to both standard streams. So in the
> following example the first line is printed to stderr and the second to
> stdout.

git 2.18.0 should print both of those lines to stdout.  This was done
to match where 'git reset --hard' prints the 'HEAD is now at...'
message. See also the thread at [1] where we did make that decision.

[1]: https://public-inbox.org/git/CAPig+cQ8VzDycUMo-QOexNDBgQGEGj2BPmPa-Y0vhGCt_brbhg@mail.gmail.com/

> $ git worktree add ../pub build2-control
> Preparing ../pub (identifier pub)
> HEAD is now at b03ea86 Update
> 
> This looks like a bug, as, for example, the checkout command prints 'HEAD is
> now at...' message to stderr.

I think eventually it would be nice to write all those messages to
'stderr', as I think they do make more sense there.  I said I may do
that at some point in [2], but never got around to it yet.  If you
want to take a stab at it, feel free :)

[2]: https://public-inbox.org/git/xmqq604rzytx.fsf@gitster-ct.c.googlers.com/

> Best regards,
> Karen

```

## Jonathan Nieder, 2018-08-05 22:45

Subject: Re: git worktree add prints to stdout
Message-ID: <20180805224536.GA208811@aiede.svl.corp.google.com>
URL: https://gitlist.dev/e/20180805224536.GA208811%40aiede.svl.corp.google.com
In-Reply-To: <20180805145254.GF2734@hank.intra.tgummerer.com>

```
Hi,

Thomas Gummerer wrote:

> git 2.18.0 should print both of those lines to stdout.  This was done
> to match where 'git reset --hard' prints the 'HEAD is now at...'
> message. See also the thread at [1] where we did make that decision.
>
> [1]: https://public-inbox.org/git/CAPig+cQ8VzDycUMo-QOexNDBgQGEGj2BPmPa-Y0vhGCt_brbhg@mail.gmail.com/

Thanks for the pointer!  And especially:

[...]
> I think eventually it would be nice to write all those messages to
> 'stderr', as I think they do make more sense there.  I said I may do
> that at some point in [2], but never got around to it yet.  If you
> want to take a stab at it, feel free :)
>
> [2]: https://public-inbox.org/git/xmqq604rzytx.fsf@gitster-ct.c.googlers.com/

Thanks for this pointer, which captures my feelings pretty well.

Jonathan

```
