There are three branches:
main-origin
2.004.x_release
615

main-origin - main, 2.004.x_release - created with main-origin, 615 branch created with 2.004.x_release.

The task is simple: get all changes to branches 2.004.x_release in 615. For this, I do

pull main-origin 2.004.x_release 

Then I see the message:

 CONFLICT (content): Merge conflict in b2b/protected/modules/Admin/views/adminPanel/addmodule.php Auto-merging b2b/protected/config/main.php Automatic merge failed; fix conflicts and then commit the result. 

I eliminate the conflict (by accepting my changes) and push. But the problem is that the files that I received are now shown as if I created them or changed them — that is, they fall into the commit on my behalf. Before the pull command in git status is empty, after I do git pull and eliminate the conflict, a lot of files appear in the git status that are marked as modified / created by me, although I did not.

How to fix it?

  • 2
    on my behalf - probably not the files, but the last commit in which you made changes. this is normal, reasonable and true. - aleksandr barakin
  • edited the message, you didn’t have time to read the verbally - "Before the pull command in git status is empty, after doing git pull and fixing a conflict, a bunch of files that are marked as changed / created by me though I didn’t do it appear in git status." - YuriiChmil
  • one
    You sent (perhaps correct, perhaps not) commits to the shared repository. yourself now you can not remove them. you can only add new commits, making the opposite changes. - aleksandr barakin

1 answer 1

When you do a git pull, there is a commit with the merge, most often automatic. When a conflict occurs, git marks lines in files (that is why they are displayed in status) and you should eliminate conflicts.

After that, you need to complete the merge by creating a commit:

 git commit 

In this case, the default editor (most likely vim ) will open the description of the merge and the list of conflicting files. Save and exit. If this is vim , press ESC then : then x and Enter , if it is nano editor then Ctrl+o then Ctrl+x .

And only after a commit with merge:

 git push 

And it’s better to indicate the server of the remote and your branch, in which the merjili:

 git push origin 615