Question

I work on a reasonably large project (well over 100K lines of code) and it's pretty messy with each developer using whichever style they feel like at the time (everything from braces to variable names to file names varies).

An obvious first step on the road to code homogeneity is to run the code through a (or a couple of) code tidy tools and ensure all code is run through those same tools on checkin (eg via jenkins).

Is there any sensible way to do this without completely nuking all our version control history? Right now I can look up a line of code and find out who wrote it and look it up in our ticketing system why they wrote it - Do we just need to give that up?

We currently use monotone but may well move to git in the near future so I'm interested in answers for either.

Was it helpful?

Solution

I unfortunately can't help you in Monotone, but as far as Git is concerned, you could try using the "smudge" feature of the .gitattributes file to automatically run your tidy tools. Pro Git has a good section on how to use smudge/clean.

To clean up past commits without destroying history, take a look at filter-branch. You could go through each commit and clean things up and still have the same commit message/changes (within reason - this could get tricky).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top