One of the 100 questions in this topic
How much do you know about Git and Version Control?The git checkout -- [file] command is used to undo changes in the working directory, restoring the file to its state in the last commit. In newer Git versions, git restore can also be used as a clearer alternative.