D
D
dzenn2016-06-11 12:18:34
git
dzenn, 2016-06-11 12:18:34

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

2 answer(s)
Артём Иннокентьев, 2016-06-11
@artinnok

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 .

T
toxa82, 2016-06-11
@toxa82

Changes couldn't just disappear. Data loss is push -f or reset --hard. You either hid them in the stash or they remained in another branch. Look towards git reflog.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question