f00860
f00860

Reputation: 3576

Remove a bunch of duplicate commits and references in git

I have the following situation:

A---B--- ... ---E---------------------------.
                                             \
                  A---B--- ... ---E---F---G---H---I--- ... ---N   master

I want to remove the duplicated commits from the history and remove this bad reference.

A---B--- ... ---E---F---G---H---I--- ... ---N   master

I've tried it with git rebase -i and remove the duplicate commits but this duplicate the commits again and results to a lot of merge conflicts.

Upvotes: 1

Views: 469

Answers (1)

Artefact2
Artefact2

Reputation: 7634

You can try:

git checkout -b temp E
git cherry-pick F..N
git branch -D master
git branch -m temp master

If you don't understand what you're doing, I suggest you read the manual pages of all the commands involved. The git manpages are very nice and accessible.

Upvotes: 1

Related Questions