Lionel T
Lionel T

Reputation: 1597

How to `rebase` to avoid duplicated commits on pull request

  1. I did a PR to a repository. Accepted and merged.
  2. I git fetch upstream on my fork.

    [Here starts the stuff I could not understand at all]

  3. I have a commit with a pre compiled message: Merge remote-tracking branch 'upstream/master'

  4. I pushed to my remote

  5. Continue working on another feature, pushed to remote and create another Pull Request where have the (3) commits of the old PR, the merge... commit and the (2 last) commits that are relative to this feature.

Here is the PR, where only the last two commits are necessary.

desired commits

As you could see, the owner propose to rebase but, sincerely, don't know how to solve it the right way.

Upvotes: 2

Views: 1168

Answers (1)

Till
Till

Reputation: 4513

You could do :

git rebase -i origin/master

(you can change the origin/master to the branch you want to rebase on)

And then remove the lines of the unnecessary commits in the interactive mode. Then save and git push -f

Upvotes: 2

Related Questions