'Github PR from 1 branch collecting all other branch commits

I am facing a problem in git, I have brach like

*main [0]

*Branch_That_I_WANT_TO_MERGE [1]

*Branch_THAT_I_DO_NOT_WANT_TO_MERGE [2]

I pushed some code in the branch 2 first and then create new branch 1 from master then push the code in branch 1, but when I am raising the PR form branch 1 to main branch then the commits which are in branch 2 are also showed up in the PR, which I don't want to merge.

git


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source