0

I was trying to commit on git, but it showed an error message as screenshot displayed below "error: Committing is not possible because you have unmerged files." Error shown after git commit

So I checked the git status, where as it responds as following: git status

I've tried some solutions such as git stash as someone suggested online, but seems not working.

How can I successfully commit my file?

P.S. this is a Coursera course submission if you need more detail about the commit background, but I guess makes no differences.

  • I would copy the c file out of the directory, `git reset --hard && git pull` then copy it back in and try to commit. You may also need to delete the txt file again before you commit if that is an important change. – Retired Ninja Apr 30 '22 at 02:50
  • [Why images of errors are a bad idea](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors-when-asking-a-question) – Jeff Holt Apr 30 '22 at 03:09

1 Answers1

1

Maybe you executed the command git pull before this.
Run the git merge --abort as suggested in the message git status, after this you commit the changes.

  • I tried it but now it said "CONFLICT (modify/delete) : 06_rect/grade.txt deleted in HEAD and modified in 2ca8732b0bfad6a38cdf6ae4c2a89b538873bd1. Version 2ca8732b0bfad6a38cdf6ae4c2a89b538873bd1 of 06_rect/grade.txt left in tree. Automatic merge failed; fix conflicts and then commit the result." Does this mean I changed some root file? – DesignByEric May 06 '22 at 09:34