1

I have 2 branches viz. dev and current

I am currently working on current which is created from dev.

Now, I made some changed to few files which included deletion of one file from the file system. I did the following:

  1. Remove from File System
  2. git commit -a -m "File deleted"
  3. git push origin current

Now on my git server (Bit Bucket), when I try to merge these branches, it gives me Conflict: Deleted in source but modified in destination error. I don't need the file and simply want it to be deleted.

I even tried

  1. git rm <file path>
  2. git commit -a -m "File deleted"
  3. git push origin current

Even this did not work. What am I missing?

kosta
  • 4,302
  • 10
  • 50
  • 104

2 Answers2

0

The file was previously committed by a different user (https). When I used the same user it solved the error. But I am not sure how would any other user do it.

kosta
  • 4,302
  • 10
  • 50
  • 104
  • I am a bit confused about the error was solved by using a different user, can you provide more details about that? Do you mean to say that you did not get the conflict when you tried to merge current into dev with the other user, but had a conflict when you tried to merge with the previous user? – dubes May 23 '16 at 10:11
0

Assuming that you cannot directly push to dev but need to merge via BitBucket, I would suggest the following:

  1. git merge or git rebase dev into current on your local repo, merge or rebase is usually a project level decision, if you are unsure, go with merge.
  2. You should get the conflict again, this time resolve it on your local, by doing rm again, see this answer for more details, essentially it is the steps that you mentioned you followed.
  3. Push your current branch and try to merge to dev again in bitbucket. This time git will understand that you want to remove the file and should allow you to proceed.
Community
  • 1
  • 1
dubes
  • 5,324
  • 3
  • 34
  • 47