Git operation problem, how to cancel "undo last submission".

I"m not familiar with the git command. I used vscode"s git management tool to "undo the last commit" twice, but now I don"t want to undo those commits. How can I restore them?

Mar.07,2021

if you keep the revocation of changes, only delete the submission record: git reset head ^ or git reset XXX (last hash)
if you also kill the modification record, use git reset-- hard head ^


git reflog to check
and then reset the commit time machine


on the first floor. You can go directly to the id number


git log first check the record you submitted
git reset-- hard xxxxxx rollback to that record
if you also want to modify the record in the remote warehouse
git push origin master-f > force push


so try not to fallback, it is best to submit a new commit, using revert fallback or diff difference before submitting a new one. The current solution to the problem, as mentioned above, can be found by git reflog to find the corresponding hash, and then reset.

Menu