DEV Community

Git-Fu: reposurgeon

Dmitry Yakimenko on February 18, 2019

In a comment to my previous post Harvey Thompson mentioned a tool called reposurgeon that is supposed to take care of the exact problem I had (merg...
Collapse
 
610yesnolovely profile image
Harvey Thompson

Yes, I also had similar issues with trying to learn reposurgeon.

In the end it was "easier" (perhaps not faster, but less headaches) to use git commands and lots of google/StackOverflow searching.

What I did take from reading up on reposurgeon is that it's a good idea to iterate on a solution:

  • Set of scripts checked into a seperate git repository.
  • The scripts start with the source unmerged git repositories and nothing else.
  • The scripts never modify the source umerged git repositories.
  • The scripts product is a merged git repository.

I ended up iterating on a Makefile which contained various git commands to take the source repositories (I think there were 13?).

At each step I added more git commands to filter commits, add branches and tags, add commit messages to map original commits to new commits, etc.

Once I was fairly happy with the result, I started trying to use the merged repo, found a few mistakes and had to rebuild it from scratch again, and keep iterating.

Took under a week to do, and theoretically I could run that script again at any time (with possible fixes) to produce an alternative branch, if I ever find issues.

It's indeed a shame that reposurgeon is super-niche. I suspect that's why the author charges consultancy fees (which is fair enough).

Collapse
 
detunized profile image
Dmitry Yakimenko

Yeah, I also iterate on scripts and use git to keep track of progress. I don't do mkdir ... anymore for new projects, I just say git init ....

Collapse
 
qm3ster profile image
Mihail Malo • Edited

I needed to merge 5 git repos into a monorepo this weekend, and I felt like being fancy and keeping history (wasn't strictly necessary in this case), so I just did this by hand: saintgimp.org/2013/01/22/merging-t...

It wasn't too bad.

Collapse
 
netmailgopi profile image
Gopi Ravi

The link is broken

Collapse
 
qm3ster profile image
Mihail Malo

Thank you!
Not anymore :D

Collapse
 
jessekphillips profile image
Jesse Phillips

From the documentation it sounds like a tool for someone who manages database translations and history pruning as their career.

Collapse
 
detunized profile image
Dmitry Yakimenko

Clearly not me =)