I
I
Ivan Medvedev2022-03-29 22:38:56
git
Ivan Medvedev, 2022-03-29 22:38:56

How to find a commit after a rollback?

Hi all! Help out. I rolled back to one of the previous commits with the command git checkout идентификатог коммита

After I built a big cloud of code. Executed commands in order

git add .
git commit -m "commit name"


Then I uploaded the work of another developer from Gitlab. Git offered to close the file in the editor and my work was updated after that.

I tried to push, I got an error associated with the branch (I don’t remember specifically) I decided to do it git checkout main- go to the main branch. After that, my work disappeared. And now I can neither roll back nor find the commit.

Any chance of recovering the files?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
egor_nullptr, 2022-03-29
@mediol-name

If you've already committed your changes, find that commit with git reflog and switch to it with git checkout.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question