cheat sheet: Suggest git-restore for discarding changes#2079
cheat sheet: Suggest git-restore for discarding changes#2079To1ne merged 1 commit intogit:gh-pagesfrom
Conversation
In modern versions of Git, `git status` will suggest using `git restore` in these cases. Also, in all other instances, the cheat sheet already lists `git switch` or `git restore` alternatives to `git checkout`.
|
This makes sense to me. |
|
I was interested what exactly means "modern versions of git" in this context... The official docs also list 2.23.0 as the oldest version of git 2.23.0 was released in August 2019 And thank you for the cheat sheet! |
|
I agree with @christophprokop. Personally I would like to double down on |
To1ne
left a comment
There was a problem hiding this comment.
Thanks for bringing in more git-restore.
In modern versions of Git,
git statuswill suggest usinggit restorein these cases. Also, in all other instances, the cheat sheet already listsgit switchorgit restorealternatives togit checkout.Changes
git restore <file>andgit restore --staged --worktree <file>as alternatives togit checkout <file>andgit checkout HEAD <file>, respectively.Context
Make the cheat sheet more consistent with
git status. Also, when teaching Git to new users, usinggit switchandgit restoreconsistently in place ofgit checkoutarguably makes common workflows easier to understand; and being able to point those new users to the official cheat sheet without introducing new commands would be a big bonus.