简体   繁体   中英

how to merge only the diff in a PR to a different branch?

I have a branch called release/app1/sprint1 from which I created my local branch feature/app1/sprint1/task1 , I was constantly merging and pulling the changes from release/app1/sprint1 to my local branch along with my own commits. There is a different branch called release/app2/sprint1 . Now my lead is saying whatever changes I added as part of feature/app1/sprint1/task1 those should be merged with release/app2/sprint1 and not release/app1/sprint1 . Is to possible to merge only the diff of feature/app1/sprint1/task1 and release/app1/sprint1 to a newly created branch from release/app2/sprint1 ?

One way I have in mind is to manually add all the changes by copy paste to a new branch created from release/app2/sprint1 and raise a pull request.

you can create a patch file from the diff and apply it to the new branch

git diff <branch1> <branch2> > diff.patch
git checkout <branch3>
git apply diff.patch

which obviously, <branch1> , <branch2> and <branch3> are your specific branch names.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM