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

Re: [PATCH v2 1/1] restore: default to HEAD when combining --staged and --worktree

From
Taylor Blau <me@ttaylorr.com>
Date
May 5, 2020, 16:04 UTC
Message-ID
<20200505160400.GC69300@syl.local>
In-Reply-To
<20200505071716.23240-2-sunshine@sunshineco.com>
On Tue, May 05, 2020 at 03:17:16AM -0400, Eric Sunshine wrote:
Show 18 quoted lines
> By default, files are restored from the index for --worktree, and from
> HEAD for --staged. When --worktree and --staged are combined, --source
> must be specified to disambiguate the restore source[1], thus making it
> cumbersome to restore a file in both the worktree and the index.
>
> However, HEAD is also a reasonable default for --worktree when combined
> with --staged, so make it the default anytime --staged is used (whether
> combined with --worktree or not).
>
> [1]: Due to an oversight, the --source requirement, though documented,
> is not actually enforced.
>
> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
> ---
>  Documentation/git-restore.txt | 11 ++++-------
>  builtin/checkout.c            |  6 +++---
>  t/t2070-restore.sh            | 11 +++++++++++
>  3 files changed, 18 insertions(+), 10 deletions(-)
Thanks, the new version looks good to me, too.
  Reviewed-by: Taylor Blau <me@ttaylorr.com>

Thanks, Taylor

Previous: Eric Sunshine
Message 3 of 3 in “enhance "git restore --worktree --staged" behavior”
  1. 0/1 enhance "git restore --worktree --staged" behaviorEric Sunshine, May 5, 2020
  2. 1/1 restore: default to HEAD when combining --staged and --worktreeEric Sunshine, May 5, 2020
  3. Taylor BlauMay 5, 2020

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.