Hacker News new | ask | show | jobs
by fouronnes3 2595 days ago
Two things I don't like in your examples:

First, the default source changes depending on the target. In my opinion it would be more intuitive and simple if the default source is always HEAD. The documentation for --source in your link probably makes sense for a git developer, but not at all for a user. (Especially the part about its default value if absent).

Second, rename "--staged" to "--index".

So in summary, to update your examples, how about:

git restore --index file # reset the index from HEAD

git restore --worktree file # reset the worktree from HEAD

git restore --worktree --source=index file # reset the worktree from the index

git restore --index --worktree file # reset both the index and worktree from HEAD

git restore file # reset the worktree from HEAD

1 comments

Since this is posted on Git mailing list, the reply is here https://public-inbox.org/git/20190515103031.GA29149@ash/