I strongly recommend to reconsider whether you absolutely need to rebase. Merging upstream into your branch might be the better option:
git fetch origin
git merge origin/master
This will:
- Not issue the same merge conflicts twice
- Not duplicate commits
Rebasing inherently re-creates all commits you are rebasing, so it is normal/expected, that your history contains multiple versions of the same commit.
With the merging workflow, your history will look like this:
MC1 <- MC2 <- MC3
^ ^ ^
\ \ \
BC1 <- BC2 <- BC3 <- BC4 <- BC5 <- BC6
Where BC3
and BC6
are merge commits resolving potential conflicts.
IMHO, rebasing is a only a good idea for:
- Short-lived branches (e.g. remote tracking branches)
- Branches with a small, number of commits (e.g. setting values in a config file)
Another option would be to squash all your commits into a single one, practically protecting you from having to resolve merge conflicts each time. But since this makes you loose history, it's probably not an option.