Kevin Bryan
Kevin Bryan

Reputation: 1858

is it possible to remove unrelated commits after merging master

I have a feature branch, after I did a git pull origin master it was full of conflicts, so I fixed it and did a commit then continued working on my feature branch.

But when I pushed and made a PR, it also included other unrelated commits from other branches. So now it's hard to review because on github is showing unrelated files that have been changed.

I only merged the default branch to my current branch, this has never happened to me before.

Upvotes: 1

Views: 1050

Answers (1)

VonC
VonC

Reputation: 1328712

Ideally, you would rebase your feature branch on top of origin/master, and resolve the conflicts then.

git switch my_feature_branch
git rebase origin/master

Then your PR would only include your work, since said work was replayed on top of the updated origin/master branch, target of your PR.

Upvotes: 2

Related Questions