From: Eric Sunshine Date: Sun, 10 Mar 2019 03:43:59 GMT Subject: Re: [PATCH v3 18/21] switch: no worktree status unless real branch switch happens Message-ID: In-Reply-To: <20190308095752.8574-19-pclouds@gmail.com> On Fri, Mar 8, 2019 at 4:59 AM Nguyễn Thái Ngọc Duy wrote: > When we switch from one branch to another, it makes sense to show a > summary of local changes since there could be conflicts, or some files > left modified.... When switch is used solely for creating a new > branch (and "switch" to the same commit) or detaching, we don't really > need to show anything. > > "git checkout" does it anyway for historical reasons. But we can start > with a clean slate with switch and don't have to. > > This essentially reverts fa655d8411 (checkout: optimize "git checkout > -b " - 2018-08-16) and make it default for switch, > but also for -B and --detach. Users of big repos are encouraged to > move to switch. I like this last bit. The skip_merge_working_tree() function which this removes was ugly, difficult to maintain, and difficult to get just right (and easy to break -- even by changing parts of the system which one might not expect to impact it).