2

We have two branches in GIT. Master (M1) and Release (R1).

M1 is periodically merged into R1.

Someone accidentally merged R1 into M1. The merge was reverted back.
Check-ins continued in M1 and also in R1.

Now when I try to merge M1 into R1 , GIT is asking to delete 140 files from R1.
I don't want those files to be deleted.

How can I merge M1 into R1 without deleting the files in R1?

I can use GIT status, save those 140 files somewhere, let the merge delete those 140 files, copy the saved files again and commit.
But I am hoping there may be a simpler way to do it.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
marcg
  • 552
  • 1
  • 8
  • 20

1 Answers1

0

But I am hoping there may be a simpler way to do it

That might actually be the more straight-forward workaround, to allow you to move forward.
The idea is to allow the merge to proceed for common files, while beeing able to restore deleted files.

As an alternative, You can also try a merge without auto-commit, and restore the deleted files (with a git checkout sourceBranch -- adeletedFile) before committing (which completes the merge)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250