V
V
VMesser2018-06-04 22:40:06
git
VMesser, 2018-06-04 22:40:06

How to rollback rm generated by merge in git?

The task is educational, I experiment.
1. First commit, created 3 files:
file1, file2, file3
2. Created a branch, made rm on file1 and file3 in it, left file2
3. Made rm on file2 and file3 in the master, left file1.
4. Made merge branches to the master. Received file2 in the master, file1 was deleted
5. Decided to roll back the last merge: git reset HEAD~1, got:

$ git reset HEAD~1
Unstaged changes after reset:
D       task1.js

At the same time, the working folder was empty, that is, file2 was deleted, and file1 was not returned.
How to be? How to return the state of the master to merge and generally cancel this merge?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2018-06-05
@VMesser

I decided to rollback the last merge: git reset HEAD~1
How to return the state of the master to the merge and generally cancel this merge?
git reset --hard HEAD~1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question