Paparis
Paparis

Reputation: 966

Duplicate Commits after rebase in the same branch

I did something stupid similar to this question: Stackoverflow question

Let me summarize it quickly:

I created a branch1 from master - did some changes - then created a different branch2 from master to do a hotfix - then i did a rebased branch1 onto the hotfix/master - and I got duplicate commits in my branch1.

Now I know i should've merged it - but how can I undo these changes? Here's a Picture of how it looks - the red rectangles are the duplicates.

Commits of my branch1

Upvotes: 1

Views: 1516

Answers (2)

AnoE
AnoE

Reputation: 8345

git checkout 2536bae
git branch branch1 -f
git push origin branch1 -f

Then inform colleagues that they should throw away their branch1 and pull it anew. If they also have made commits, they can fix the issue by cherry picking their own commits after getting your fixed version and proceeding as usual.

Upvotes: 2

eftshift0
eftshift0

Reputation: 30212

git reset --hard 54a69ae git merge -m "merging" f072912

Upvotes: 0

Related Questions