How to create a branch of the diff using git command line

Viewed 25

I forked a project (i.e., MainProject:main ) into Jay:main. I created a new branch Jay:feature from Jay:main. In MainProject:main I created a pull request using Jay:feature.

After many merges done to MainProject:main, my PR has a conflict that need to be addressed before it can be merged.

I pulled the lasted changes from MainProject:main into Jay:main so both branches are at sync. While on Jay:feature, I executed git rebase main to ensure all the changed from Jay:main make it to Jay:feature in order to resolve the conflict.

Then I did git commit followed by git push. Unfortunately, my PR now has way too many file which should not be part of the PR.

How can I get only the diff files into the PR?

I thought I would just create a new branch using the difference between Jay:main and Jay:feature. Here is what I did git checkout feature then git reset --mixed so I can stage the difference between the two branches.

Now, I am not sure how would I commit my staged files into a new branch? Or, is there a better way to make sure my PR only include the stages files?

0 Answers
Related