Skip to content

Conversation

sckfranke
Copy link

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.

Changes

  • Add git restore <file> and git restore --staged --worktree <file> as alternatives to git checkout <file> and git checkout HEAD <file>, respectively.

Context

Make the cheat sheet more consistent with git status. Also, when teaching Git to new users, using git switch and git restore consistently in place of git checkout arguably 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.

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`.
@jvns
Copy link
Collaborator

jvns commented Sep 19, 2025

This makes sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants