5
Consider the following story:
- In the local repository I commit A and B.
- I pushed to the repository on the server.
- I went back to the local repository and made changes.
- I removed commit B from the local repository (using the command below) before committing the new changes:
git reset --soft HEAD~
How do I recover the removed commit from the local repository so that the history matches the server repository and without losing the changes who have not yet been committed?
git reflog
to list all commits (including floating state), andgit merge [SHA1]
to bring it back to the repository.– OnoSendai
@Onosendai Yes, that was it, solved the problem and I haven’t lost my changes. Please add an answer to accept it as sure. Thank you.
– Filipe Moraes
@Filipemoraes feel free to implement the answer describing your process and accept it. And I’m glad it worked out for you. =)
– OnoSendai