I’ve been using git for a while on a project, and its time to clean up.
I have a few source code files that have become to large and should be split up into multiple files. I also want to move some functions from one file to a more appropriate one.
Since git tracks all my changes, will this effectively double the size of my git repo? Is there a way to avoid this? Or is it a better practice to keep a history of these changes? (in case for some reason I want to go back to the messy state I’m currently in)
Thoughts, opinions and solutions welcome!
Thanks.
As with all revisions, the size of your git repository will increase with your changes, however, I do not think that this should be something you ultimately worry about too much. I would suggest that it is better to keep the history as you make these changes, not least so that you can undo your actions if something goes wrong, but also it helps anyone else who may be working with your repository either now or in the future to understand what has happened to certain files (if indeed they care to check using
git blame).(If you want to modify or “squash” previous revisions together, you can look at using
git-rebase, but modifying git history often comes with disastrous consequences – I don’t advise it, and it certainly isn’t for the faint of heart.)