Have you ever blown
Recently I have described how to undo one type of operation – commit. This article presents how to undo various types of operations on a local repository and why it is useful.
Someday I was working on my feature branch and I realized it needs master’s commits. Therefore I did git rebase master and resolved all conflicts. Then I run the project in Unity Editor and the editor crashed. I resolved conflicts of a scene file in the wrong way. Unity Editor saves scenes in YAML format which is not easy to read, so I was not able to find the issue. I had to undo these changes.
Undo local operation – solution
Do you know git log command? It displays a history of a local repository commits. In one log there is a commit’s message, creation time, author and hash. The hash is a unique identifier of a commit.
A similar command is git
git reset –hard 0ffe661
git reset –hard removes a commit as well as a local tracked changes. The number next to the command is a hash of an operation that is desired the last operation in a local repository.
As you can see in the above screen, git reset –hard does not remove a log from
Now we have the desired situation – commit does not exist and changes either.
I use git