S
S
SeoNk2017-03-24 21:40:35
git
SeoNk, 2017-03-24 21:40:35

How to undo a Git commit?

Developed the project, made commits.
Next, I rolled back two commits by running git reset --hard HEAD^ twice.
Then I created the new branch with git branch new, switched to it with git checkout new
, and deleted the master branch with git branch -d master.
Tell me how to get back to the "as it was" state again?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
aol-nnov, 2017-03-24
@SeoNk

start here: git reflog
those things on the left in the output of the command can be used as identifiers in the checkout.
then, having felt all the depth, read about git fsck and git gc.
If all else fails, shut up :-D

H
hufawoso, 2017-03-24
@hufawoso

no way)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question