Answer the question
In order to leave comments, you need to log in
Why the difference between documentation and actual GIT commands?
Good day to all. In the process of studying GIT, I encountered an extremely interesting phenomenon. I will say right away that I am learning it based on git-scm and githowto.
The essence of the issue is the difference between the commands offered by the git to cancel certain actions.
In all tutorials, this is:
(use "git checkout -- ..." to discard changes in working directory)
(use "git reset HEAD ..." to unstage)
But in fact, when working with git-bash, we get the following picture
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git restore ..." to discard changes in working directory)
modified: hello.html
and
$ git st
On branch master
Changes to be committed:
(use "git restore --staged ..." to unstage)
modified: hello.html
Why is that? And what is the best way to use.
For clarity, I am attaching a screen:
The second screen is taken from the site: https://git-scm.com/book/en/v2/Git-Basics-Recordin...
Answer the question
In order to leave comments, you need to log in
The git restore command (and git switch) are relatively new, with version 2.23 in August 2019.
They are designed as simpler replacements for the main uses of git checkout to make it easier for newbies (and not only).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question