Search code examples
gitrebase

remove copies / fork in git history


I have the following git history, not really sure how i got there, but it seem i have a set of copies of D-G (git diff D D-copy is empty) which creates a fork in my git history, is there a way to fix this to remove the copies and create a history without the fork?

*   b4c394e (HEAD -> master, origin/master) I
|\
| * 17738ee G-copy
| * 6300744 F-copy
| * 62dbb41 E-copy
| * 951a5d9 D-copy
* | 05bfe4f H
* | 2701442 G
* | 242cf72 F
* | 2c9c7b6 E
* | b4bf474 D
|/
* 0f445d1 C
* ac8114f B
* 87759e6 A

Solution

  • I did a git reset HEAD~1 and now the history was clean again (no fork) with the changes from the last commit, which i added as a new commit and forced pushed. I did rename a remote repository recently, maybe that caused the problem.