Hacker News new | ask | show | jobs
by mleonard 2595 days ago
Hi. Interesting to know thanks!

Would you mind giving the current commands to achieve the three things you just listed?

That way I learn the future restore command along with the current approach and you description. T

1 comments

"git restore --staged" should be the same as "git reset -- file" (--mixed, --soft and --hard cannot be used with individual files).

"git restore --worktree" is the same as "git checkout -- file".

"git restore --source..." should be the same as "git reset --hard -- file" if --hard was made to work with individual files.

Though "git restore" should make it clear (or clearer) to the user what they want to restore without resorting to more mysterious options like --hard/--soft. So if that's not obvious from my examples, I think I've failed :)

Thanks really very helpful!

When you hoping to have git restore in the official git release?

> When you hoping to have git restore in the official git release?

If things go well, maybe v2.23.0, unless we find serious UX flaws and scrape the whole thing.