-2

When I tried to commit , following error occured.

I searched, But as I am beginner,I'd like to understand the status.

 $ git commit -m "test"
U       api/src/app.module.ts
U       api/src/entities/user.entity.ts
U       api/src/main.ts
error: Committing 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.

How can I merge them ?

I keep both change in vscode.

are there any additional command ?

If someone has opinion, please let me know.

Thanks

git status is following.

$ git status
On branch event-api
Your branch and 'origin/develop' have diverged,
and have 11 and 20 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Changes to be committed:
        modified:   ../../ormconfig.js
        modified:   ../../package.json
        new file:   ../config/CustomNamingStrategy.ts
        modified:   ../entities/child.entity.ts
        new file:   ../entities/condition.entity.ts
        new file:   ../entities/defecation.entity.ts
        new file:   ../entities/food.entity.ts
        modified:   ../entities/height.entity.ts
        new file:   ../entities/notice.entity.ts
        new file:   ../entities/sleep.entity.ts
        new file:   ../entities/temperature.entity.ts
        modified:   ../entities/weight.entity.ts
        modified:   event.controller.ts
        modified:   event.service.ts
        new file:   ../health/dto/health-info-filter.ts
        new file:   ../health/health-item.enum.ts
        new file:   ../health/health.controller.ts
        new file:   ../health/health.module.ts
        new file:   ../health/health.service.ts
        new file:   ../notices/dto/notice.dto.ts
        new file:   ../notices/notice.service.spec.ts
        new file:   ../notices/notice.service.ts
        new file:   ../notices/notices.controller.spec.ts
        new file:   ../notices/notices.controller.ts
        new file:   ../notices/notices.module.ts
        modified:   ../repositories/child.repository.ts
        new file:   ../repositories/notices.repository.ts
        new file:   ../shared/http-exception.filter.ts
        new file:   ../shared/timeout.interceptor.ts
        modified:   ../../yarn.lock

Unmerged paths:
  (use "git add <file>..." to mark resolution)
        both modified:   ../app.module.ts
        both modified:   ../entities/user.entity.ts
        both modified:   ../main.ts

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   ../entities/child.entity.ts
        modified:   ../entities/condition.entity.ts
        modified:   ../entities/defecation.entity.ts
        modified:   ../entities/event.entity.ts
        modified:   ../entities/food.entity.ts
        modified:   ../entities/height.entity.ts
        modified:   ../entities/sleep.entity.ts
        modified:   ../entities/temperature.entity.ts
        modified:   ../entities/weight.entity.ts
        modified:   dto/event.dto.ts
        modified:   ../health/dto/health-info-filter.ts
        modified:   ../health/health-item.enum.ts
        modified:   ../health/health.controller.ts
        modified:   ../health/health.module.ts
        modified:   ../health/health.service.ts
        modified:   ../migrations/develop/1592202356067-create-user.ts
        modified:   ../repositories/child.repository.ts
        modified:   ../shared/http-exception.filter.ts
        modified:   ../shared/timeout.interceptor.ts
        modified:   ../user/dto/user-search.request.ts
        modified:   ../user/user.module.ts

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        ../../../.vscode/
        ../../.env
        ../entities/attendance.entity.ts
Heisenberg
  • 2,855
  • 1
  • 16
  • 31
  • 2
    The error says what to do "Fix them up in the work tree, and then use 'git add/rm ' as appropriate to mark resolution and make a commit." - Work-tree is your file system. – evolutionxbox Oct 24 '20 at 15:28
  • 2
    Does this answer your question? [How to resolve merge conflicts in Git?](https://stackoverflow.com/questions/161813/how-to-resolve-merge-conflicts-in-git) – evolutionxbox Oct 24 '20 at 15:29

1 Answers1

1

If you open each file in this section of your git status, you will see marker lines that were automatically added by Git as a result of being unable to determine an automatic resolution (i.e. same lines that were modified):

Unmerged paths:
  (use "git add <file>..." to mark resolution)
        both modified:   ../app.module.ts
        both modified:   ../entities/user.entity.ts
        both modified:   ../main.ts

Conflict markers

For each file, what you need to do is manually edit the contents and erase the outdated change by yourself including the conflict markers themselves. Only then you can issue a git add then ultimately run your git commit -m "test" command.

<<<<<<< HEAD
Baz.
=======
Bar.
>>>>>>> main
maronavenue
  • 131
  • 3