And if that's not enough, Eric S. Raymond has written a bunch of absurdly powerful tools for scenarios like this one:
http://www.catb.org/esr/reposurgeon/
https://gitlab.com/esr/git-debubble
https://gitlab.com/esr/git-weave
Some background information provided by ESR, in addition to what you can find on the homepage:
https://groups.google.com/forum/m/#!topic/golang-nuts/WstriK...
https://news.ycombinator.com/item?id=22304131