git - How can I clean the history of / remove duplicate commits from my master branch? -
i'm trying clean old repository, may first 1 created when still learning how use git. looking @ history of master
, noticed this:
r -- p -- -- b -- c -- d -- m -- e \ / a' --- b' --- c' --- d'
where a'
, b'
, ... same commits a
, b
,... m
merge commit , e
isn't last one.
there 2 branches in repository (master
, develop
), , master
affected(develop
has been created later).
i remove duplicate commits, p
(exclusive) m
, resulting in this:
r -- p -- -- b -- c -- d -- e
how achieve that?
seems m merge of branch rebased version of same branch
i following:
git checkout master git rebase --onto d m
this commands rebase commits m master branch tip on d (removing m history), since a' - b' - c' - d' reachable because of m, commits "removed" history , history end way looking for:
r--p-----a-----b----c----d----e
rebase powerful command, can amazing things :)
Comments
Post a Comment