I have three branches for my repository, master, feature_1, feature_2
I'm working with all my changes on feature_1 branch, and let's say "Tim" branched out feature_2 branch like this from my branch feature_1
----------------- feature_1
\ _ _ _ _ _ _ _ _ _ _ feature_2
----------------- master
Now, when Tim starts working on feature_2 branch, he deletes some files and checks in the code. feature_1 still contains those files. Tim raises pull request to master branch and those files are deleted in master now.
Now, if I raise pull request from feature_1 to master, it should ideally show the changes which states the files are being added, (which Tim deleted in feature_2 branch and merged ). But it is not showing those changes. How to get those changes as diff and merge back to master?
-
1"it should ideally show the changes which states the files are being added" No, that’s not what a merge is or what a diff is. On your branch nothing happened to those files. On master they were deleted. Therefore on a merge they are deleted. No branch added them.matt– matt2020年08月10日 12:34:26 +00:00Commented Aug 10, 2020 at 12:34
-
1You could edit all the files before the merge. Now the merge would have conflicts between the edit and the delete, which you could resolve manually, making the edit win over the delete.matt– matt2020年08月10日 12:36:53 +00:00Commented Aug 10, 2020 at 12:36
-
1@matt Agreed, and it should be a (concise but useful) answer.Romain Valeri– Romain Valeri2020年08月10日 12:37:44 +00:00Commented Aug 10, 2020 at 12:37
1 Answer 1
it should ideally show the changes which states the files are being added
No, that’s not what a merge is or what a diff is. On your branch nothing happened to those files. On master they were deleted. Therefore on a merge they are deleted, as that is the only thing that happened to them. No branch added them.
If you really want the merge to restore the files, I suppose you could edit all the files before the merge. Now the merge would have conflicts between the edit and the delete, which you could resolve manually, making the edit win over the delete.
Or do the merge, then make a branch where you restore the files, and merge that.