1

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?

mike
1,2431 gold badge15 silver badges38 bronze badges
asked Aug 10, 2020 at 12:29
3
  • 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. Commented Aug 10, 2020 at 12:34
  • 1
    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. Commented Aug 10, 2020 at 12:36
  • 1
    @matt Agreed, and it should be a (concise but useful) answer. Commented Aug 10, 2020 at 12:37

1 Answer 1

3

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.

answered Aug 10, 2020 at 12:40
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.