Recommend Use of git restore When Working With Files - #2187
Conversation
Replaces `git reset` commands that deal with restoring files from the working tree or index with `git restore`. I believe this better aligns with the documentation, in particular [Reset, restore and revert](https://git-scm.com/docs/git#_reset_restore_and_revert) > git-restore[1] is about restoring files in the working tree from either the index or another commit. This command does not update your branch. The command can also be used to restore files in the index from another commit. > git-reset[1] is about updating your branch, moving the tip in order to add or remove commits from the branch. This operation changes the commit history.
|
I think this would be a good use of the "OR", like with "Delete unstaged changes to one file:" where we show both how to use I'm also curious about your experience with My impression is that many Git users (including me!) aren't really familiar with |
|
@jvns Good callout about using OR. Perhaps I was too aggressive in removing the I've added the original
I'm similar to you. I felt I owed it to myself to review git commands and read the documentation more carefully to understand git more intimately. After reading, I now try my best to use the newer commands like The idea behind this PR is to align the documentation with the cheat sheet. I think adding the OR is a good gentle introduction to use cases for |
Provides alternative examples using
git restoreforgit resetcommands that deal with restoring files from the worktree or index.I believe this better aligns with the documentation, in particular Reset, restore and revert