Hands-on task
This task is step 4 of the course “Everyday Git”
Restore a file to its version from history
In the repository /root/repo the file file.txt was committed with the line good, but then it got accidentally messed up — right now the working tree holds bad (the change is not staged). Restore file.txt to the last committed version: the content should become good again, and the working tree should be clean.
Reference:git
What you'll practise:
- git restore
- git checkout --
- working tree
- discarding edits
- HEAD