I have a git repository that looks like this:
A1 - B1 - C1 - D1 - E1
C2 - D2 - F2
The file changes in C1
and C2
are identical. If I run git diff C1 C2
then I get an empty result. Likewise, the file changes in D1
and D2
are identical.
The commit messages of C1
and C2
are different, and the commit messages of D1
and D2
are also different.
The hashes of C1
and C2
are different. Likewise, the hashes of D1
and D2
are different.
The changes in E1
and F2
are completely different.
I would like to get a repository that looks like this:
A1 - B1 - C1 - D1 - E1
F2
I already tried git rebase
and git rebase --onto
and that just keeps the commits C2
and D2
.
This is a fictional example. Here there are 2 commits that have the same changes. In reality there may be a few dozen or hundreds commits that have the same changes before the code diverges, and there is no simple way to determine how many without examining the entire history in detail.