Answer the question
In order to leave comments, you need to log in
How to rollback to git?
Hi everybody!
I, as usual, did a simple procedure to upload the code to the repository. But after I did the push, I got an error that I need to download the changes that are on the repository, but I don’t have it, that is, git pull. After executing this command, my code was completely overwritten for the last day. How can you do a rollback? ps but the code could not be uploaded because the code was gone
Answer the question
In order to leave comments, you need to log in
Your code is not lost - all changes are saved in the version control system (if you made commits).
It is impossible to roll back - you can go to a certain moment in the history of changes (commit).
You need to look at the commit number in the repository to which you want to roll back, usually something like 3ff82acd8457abe69f6a26c3511fca100b95a49f , the first 7 characters are enough - 3ff82ac . You can find out the commit number either in the web version or through the command:
Having found out the commit number, do the following:
That's it, you have successfully switched to the version that you have in the commit.
In general, if you want to get better at git, take this course .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question