Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot soft reset git repository in the middle of a merge, but there is no merge to abort

When running the command git reset --soft HEAD^ in my repository, the terminal tells me it is in the middle of a merge:

fatal: Cannot do a soft reset in the middle of a merge.

But when trying to abort the merge with git merge --abort, the terminal states that there is no merge:

fatal: There is no merge to abort (MERGE_HEAD missing).

Is there a "hidden" merge in git of some sort? I don't know much about how git works and am not sure how to fix this. If I run git reset --hard HEAD will the changes I made to the files still be saved and I just have to restage and commit them?

like image 857
Fergus Avatar asked Jun 21 '20 17:06

Fergus


People also ask

How do I undo an unfinished merge?

git merge --abort is equivalent to git reset --merge when MERGE_HEAD is present. After a failed merge, when there is no MERGE_HEAD , the failed merge can be undone with git reset --merge , but not necessarily with git merge --abort .

How do you abort a merge in git?

You can use the git reset --merge command. You can also use the git merge --abort command.

How do I cancel a merge request?

Go to the merge request you want to delete, and select Edit. Scroll to the bottom of the page, and select Delete merge request.


1 Answers

Partial answer: you'll lose all the changes you made while running git reset --hard

like image 151
codegorilla Avatar answered Oct 11 '22 02:10

codegorilla