Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cant commit after starting a merge in Sourcetree

When trying to commit after a merge I'm getting this error message:

"fatal: You are in the middle of a merge -- cannot amend."

How do i resolve this? as far as I know I have resolved all conflicts, i just need to complete the merge and commit the changes. but the product won't let me and doesn't give me any clues as to what I am meant to do next, and there is no option to "complete the merge"

Everytime I try to commit my changes I get the error message and I now have no idea what to do about it!

like image 237
johnvdenley Avatar asked Mar 03 '14 00:03

johnvdenley


People also ask

How do I commit changes after merging?

Right click the new branch created in step 2 and select "Merge From" and uncheck the checkbox "Commit Changes after merging" and click "Merge" Expected: Changes merged to the branch and ready for reviewing Actual: Repository updated to commit and no option to review changes before committing.

Do you need to commit after a merge?

yes ..you need to commit MERGE STATEMENT.

Does a merge create a commit?

Merging your branch into master is the most common way to do this. Git creates a new commit (M) that is referred to as a merge commit that results from combining the changes from your feature branch and master from the point where the two branches diverged.


1 Answers

You can manually delete .git/MERGE_HEAD and Git won't be able to tell that you were just doing a merge. It will let you amend the previous commit with the changes in your index just like normal.

Please read:

Though this would work, it is a hack and not recommended. All is needed here is to let git know the merge is completed git commit -a as per this answer

like image 151
Rag Avatar answered Oct 10 '22 19:10

Rag