Reputation: 2809
How to reload the previous history of the file in git source control in vscode? vs code provides to restore only last commit and I can see all the history of the file with "Git History" extension in vscode but is there any way to roll back to any history of the file?
Upvotes: 5
Views: 15436
Reputation: 8560
There is an awesome extension called GitLens for that:
After installed, go to thee source control tab, right click on the file and select, "Open File History". Select your commit, then right click over it and click "Restore" from popup menu.
Upvotes: 11
Reputation: 1765
If you want to checkout a previous commit, I recommend to do it using command line:
ctrl + j
to open up a terminal in VSCodegit log
to see commit history (or you can do that by looking the commit history from repo's page, e.g on Github). the commits are sorted that the upper one is more recentSHA key
of the commit you want to checkout and run git checkout sha_key
. sha_key
is the key you just copiedUpvotes: 4