Re: [PATCH] checkout: special case error messages during noop switching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks! (This is a fix for a bug I reported internally at work.)

On Tue, Jul 2, 2024 at 10:52 PM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> "git checkout" ran with no branch and no pathspec behaves like
> switching the branch to the current branch (in other words, a
> no-op, except that it gives a side-effect "here are the modified
> paths" report).  But unlike "git checkout HEAD" or "git checkout
> main" (when you are on the 'main' branch), the user is much less
> conscious that they are "switching" to the current branch.

Yes, that's exactly what happened to me. I should have used `git
restore` instead. I know that's the modern way of updating paths, so I
don't know why I didn't think of it. I just verified that `git restore
--ours <path>` works for restoring a conflicted file to my side.

> [Footnote]
>
>  * Yes, the end-users are irrational.  When they did not give
>    "--ours", they take it granted that "git checkout" gives a short
>    status, e.g..

I actually did not even know that it does that :) I'm a bit surprised
that it does, especially since `git checkout <non-HEAD>` doesn't seem
to do that. But that's off topic.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux