0

Hi I have a conflict CONFLICT (rename/delete) in my repo.. yesterday I have deleted a migration file from master branch which is not present either any of other feature branches, but when I try to push my develop it returns the CONFLICT (rename/delete) error .. the conflict isn't in the content.. because it is a separate file.. why this happening and how to resolve this?

 * branch            master     -> FETCH_HEAD
 bb4104c5ebfc8c50640b11ee983a229536f12bbe and renamed to database/migrations/2021_03_12_082940_add_exercise_group_id_exercise_table.php in HEAD. Version HEAD of database/migrations/2021_03_12_082940_add_exercise_group_id_exercise_table.php left in 
tree.
JEJ
  • 814
  • 5
  • 21

1 Answers1

1

why this happening ...

It's happening because there is a conflict between a rename and a delete.

This answer is not very helpful, but it is as helpful as possible, given what you have told us. In particular, one of the things you did tell us is wrong:

when I try to push my develop it returns the CONFLICT (rename/delete) error

git push never does a merge, and the conflict occurs on a merge. Your output here:

 * branch            master     -> FETCH_HEAD

is from git pull, not git push. The pull command means run git fetch, then run a second Git command and the default second Git command is usually git merge, so that part makes sense: you ran git pull, which ran git merge, which encountered this rename/delete conflict.

Perhaps you mean to ask "what are some examples that cause a rename/delete conflict", which is answerable: see, e.g., git rename/delete confusion.

... and how to resolve this?

You, as the (smart) human programmer, must decide what the correct set of files in the final merge is to be. Git is a dumb simple program, following some simple rules; those rules have hit a problem.

See, e.g., Git - what does CONFLICT (rename/delete) mean? and git - merge conflict when local is deleted but file exists in remote and How do I fix a merge conflict due to removal of a file in a branch? Some of these are about modify/delete conflicts, rather than rename/delete, but in the end the process is always the same:

  • Git tried to merge, using its dumb and simple rules.
  • These dumb and simple rules failed. Git stopped in the middle of the merge.
  • Your job is now to fix the mess Git left behind. Figure out which files should exist and what should be in those files.

Once you have the right set of files, with the right contents, use git add and/or git rm to tell Git these are the right files. Then run git merge --continue to finish the in-progress merge.

torek
  • 448,244
  • 59
  • 642
  • 775