
1. Discard changes to local files in git
As a programmer, it happens every day that unexpected errors occur. To solve the errors quickly...
For further actions, you may consider blocking this person and/or reporting abuse
See the original post, which has far better text (and command) formatting, as well as screenshots, and discusses 7 rather than 4 "Git mistakes" .
agreed, that original post has better view and explanation....
the original post is also written by me....
I was trying to make series of it...
🔥
Point 1 can also be achieved through
git reset --hard HEAD
.git checkout
is most handy if you only wish to undo changes in one directory or a specific file by checking out that directory/file again.🔥
I wrote a cheat sheet for Git and Github where I used the book that is referenced in the pdf. It's a free book and well worth downloading. You'll find my cheat sheet at: github.com/ChrisJohDev/pub-GitAndG...
Enjoy it's free. ;)
Nice.!
I think that
git config --global <something>
is also a mistake. Because, I guess, in most cases we have the company repo and personal repos cloned in the computer. And the configuration of git are usually different in both (user.name and user.email, for example).Point 3 can be done with
git rm --cached filename
🔥
Instead of
git checkout - myFile
we can use the commandgit restore myFile
which is less ambiguous in and less error prone since it's dedicated to that task.🔥
Handy tips. Thank you. I’ve become too reliant on Visual Studio Codes source control for unstaging stuff.
Thanks
These are very helpful 👍🏽 Thanks for the article!
Thanks