My starting point is to check the current status, both locally and in VSCode.
Now I’m making a small change in jor.txt and saving but I have not staged or committed.
Imagine I have broken something, and I want to revert to the last committed version. If I use the command git checkout filename I can revert to the previous version. I could also use git restore filename.
I have changed the same file again and this time, I have staged the change.
You may notice, each time git tells me my options! In this case, I will restore the staged file.
Now I can either remodify or restore from the last commit.
This time I will stage and commit all using VSCode. I am using the message “Update at 14:46”.
First, I need to identify the version I want. As you can see, my messages are very unhelpful, that is a lesson! I want to revert to a previous saved version.
To go back to that version, I can also use git checkout hash with the hash of the version I want to restore.
I can then commit this and push it to GitHub.
And finally, to check it really has updated....