From: Junio C Hamano Date: Thu, 06 Oct 2022 19:30:07 GMT Subject: Re: Bug report: `git restore --source --staged` deals poorly with sparse-checkout Message-ID: In-Reply-To: <96c4f52e-bc66-f4ee-f4f6-d22da579858e@github.com> Victoria Dye writes: >> Restoring only into the index (as I think `git restore --staged` is supposed >> to do) is weird. > > 'git restore --staged' is intended to restore to both the worktree and index > (per 183fb44fd2 (restore: add --worktree and --staged, 2019-04-25)). The bug > you've identified is that it's not restoring to the worktree. I think you misread 183fb44fd2, which says --staged is to restore the contents in the index and --worktree is to restore the contents in the working tree, and both of them can be used at the same time to affect both destinations. As gitcli(7) says, --staged here is a synonym to --cached here and should not touch the working tree. Having needless synonym may be a source of confusion, so we may want to straighten out the UI a bit around here, but that is a separate topic. Thanks.