To explain what is happening:
This is where you start:
* ----- * ----- *
origin/main
You make your first commits and end up in this situation:
* ----- * ----- * ----- * ----- * ----- * ----- * ----- * ----- * ----- *
origin/main. Feature A
Now you create a pull request and are ready for the next feature.
If you keep working on this branch, the new PR will contain all the changes of Feature A + everything you commit after:
* ----- * ----- * ----- * ----- * ----- * ----- * ----- * ----- * ----- * ----- * ----- * ----- *
origin/main. Feature A. FB
Instead you should make sure you create a branch for FB from origin/main again. There are many ways to do that:
git branch fb
git checkout fb
git reset origin/main --hard
Or do all of that in a single command:
git checkout -b FB origin/main
That way you end up with this after adding a few commits to FB;
* ----- * ----- * ----- * FB
/
* ----- * ----- * ----- * ----- * ----- * ----- * ----- * ----- * ----- *
origin/main. Feature A
To fix your current predicament you can rebase FA...FB onto origin/main or create a new branch and cherrypick the commits after FA into your new branch.
git rebase --onto origin/main fa fb
Or you can do an interactive rebase where you drop the commits between origin/main...FA.
git checkout -b fbfixed origin/main
git cherry-pick fa..fb
See also:
Final trick would be to do an interactive rebase of FB:
git rebase -i origin/main..fb
This should show a list of commits between origin/main and FB. Mark all commits after origin/main up to and including FA as drop then perform the rebase:
k 12344 FB
k 27362
k 37383
d nsnsnsn FA
d hshscd
d rnsees
d rhsnsn
d snrrirh
d rifitbrn
d usbrve
This will drop the commits of FA from branch FB. It will leave the original FA in tact.