- Return to the previous version of the work you have committed locally but not pushed to your remote repo
Return to the previous version of the work you have committed locally but not pushed to your remote repo
If your files are committed locally, and you haven’t pushed your changes to your remote repo, you can still return to the previous version of your work.
First, we’re going to confirm the files committed by checking the status of the repo.
wvs git status
If they were committed, they would not show up, but you will see a message similar to the example below.
D:\WVSprojects\LyraStarterGame52>wvs git status On branch main Your branch is ahead of 'origin/main' by 5 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean
Once confirmed that the files were committed locally but not pushed to your remote repository, here are your options. If you want to undo the individual file, you must move it out of your local commit.
wvs git restore --staged <file>
Once the file is moved out of your local commit, you can undo the individual file.
wvs git checkout -- <file>
If you want to revert/undo all your changes, you could run the following command. Be careful using this one, it will affect all the changes you have, not just one file.
wvs git reset --hard