0

I am getting the following error while merging the master branch into my development branch using git.

Error:

error: Merging is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.

I am explaining my process below.

1- I was working with my dev branch locally.

2- I checked out to master branch by using below below command.

  `git checkout master`

3- Then I pulled the latest code from master branch using the below command

`git pull`

4- Again I checkout to my branch using the following command

git checkout dev (dev is my branch name which is cloned from master intially)

5- Then I had to merge the master branch code to dev branch. so i performed the below command.

git merge master

6- Then only I am getting the above error.

Here I need to merge the latest code from master branch to dev branch and push into to remote dev branch. I need to resolve this error and merge the code.

  • git status should show you which files are to be fixed because they might have merge conflict makers in them, indicative of unresolved merge conflicts – VonC Oct 15 '20 at 10:59
  • Does this answer your question? [GIT merge error "commit is not possible because you have unmerged files"](https://stackoverflow.com/questions/12961752/git-merge-error-commit-is-not-possible-because-you-have-unmerged-files) – kosist Oct 15 '20 at 11:00
  • How about doing `git rebase master` ? This will put your commits above the master's commits in the history tree – Tasos Bu Oct 15 '20 at 11:00

1 Answers1

0

The error is telling you what you need to do - you need to resolve conflicts in your files. Once they're resolved, you can do git add -u. After then, git commit and the merge will be complete.

ignoring_gravity
  • 3,911
  • 3
  • 16
  • 33
  • I have resolved the conflict. In one file something was coming like `HEADER===` . I removed those but after that when I am trying to do the git merge again these errors are cming. – subhra_edqart Oct 15 '20 at 13:52
  • First I did `git merge master` I got `CONFLICT (content): Merge conflict in `mean-stack/node-js/app.js, Automatic merge failed; fix conflicts and then commit the result.`. After that I cleared those lines from app.js. – subhra_edqart Oct 15 '20 at 13:59
  • Again I did same `git merge master` after removing the lines like `HEADER===` but getting the error which I have posted. – subhra_edqart Oct 15 '20 at 14:00
  • after you clear the lines you need to do `git add -u` and `git commit` – ignoring_gravity Oct 15 '20 at 14:01
  • I will do but the new codes from app.js master branch is not merged into my local branch app.js. – subhra_edqart Oct 15 '20 at 14:03
  • Now when I am checking git status. Its giving me `You have unmerged paths. (fix conflicts and run "git commit") (use "git merge --abort" to abort the merge)`. – subhra_edqart Oct 15 '20 at 14:06
  • After you clear the lines, the first thing to do is `git add -u` and then `git commit`. That's how you fix conflicts, can you try that? – ignoring_gravity Oct 15 '20 at 14:09
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/223093/discussion-between-subhra-edqart-and-ignoring-gravity). – subhra_edqart Oct 15 '20 at 14:10