Skip to content

Conversation

BPylypenko
Copy link
Contributor

Changes

It’s important to understand that git checkout —  is a dangerous command. Any local changes you made to that file are gone — Git just replaced that file with the most recently-committed version. Don’t ever use this command unless you absolutely know that you don’t want those unsaved local changes.

It’s important to understand that git checkout —  is a dangerous command. Any local changes you made to that file are gone — Git just replaced that file with the last staged or committed version. Don’t ever use this command unless you absolutely know that you don’t want those unsaved local changes.

As it's more precise what's happening when you have staged file, then made changes to them and then reverted unstaged changes.

Context

Fixes #1602

Copy link
Member

@Morganov Morganov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@ben
Copy link
Member

ben commented Feb 16, 2021

Yes, that's definitely better. Thanks!

@ben ben merged commit 1b7fb5e into progit:master Feb 16, 2021
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.

Add more clarity what git restore and git checkout -- <file> does

3 participants