Additional files get added when making a PR

Viewed 46

I'm fairly new to using GIT. I'm having some issues when I make Pull Requests..

I create a branch called branch1 and make a PR of let's say 4 files to my remote repo.

Now when I checkout another branch branch2 from my branch1 and create a PR for 2 more files, the previous 4 files get added into this PR as well.

Not sure how to rectify this.

1 Answers

As you created the branch2 from branch1, branch2 contains also the changes of branch1 - this is visible in the PR.

You should create a "clean" branch, e.g. from master instead of branch1. Commit the changes and those will be fully separated from branch1, then the PR will have only those changes.

How to fix? Git rebase branch2 on the main branch, e.g. master, and skip the unneeded commits (those from branch1)

Related