5

I have a somewhat popular open-source project on Github, and I'm getting ready to do a major overhaul - completely different directory structure, substantially different versions of major components, and lots of files that simply won't exist anymore.

I don't want to create a completely new repo, because we will lose all of the issues, stars, wiki pages, and other goodies that come with a Github repo. On the other hand, starting on a new dev branch seems less-than-ideal, because I will have to .gitignore a lot of untracked files from the old version to be able to easily switch between the two versions.

Other ideas I've considered:

  • Create an empty orphan branch for the new version;
  • "Fork" the current version into a new repo, develop it in the new repo, and then merge that fork back into the original repo when ready for release (is this even possible?)

What is the best approach for doing such a major revision?

  • 1
    Why would you have to .gitignore a bunch of files? When you switch branches, they shouldn't remain in your file system. – RubberDuck Jun 23 '16 at 21:51
  • What are these untracked files? – Winston Ewert Jun 23 '16 at 22:19
  • @WinstonEwert config files, mostly. – alexw Jun 23 '16 at 22:25
  • How many config files do you have? Are they going to be different in the new version? – Winston Ewert Jun 23 '16 at 22:33
  • @WinstonEwert just one in the old version, but there will be quite a few in the new version. So, maybe it's not quite as bad as I originally thought. But yes, they will be substantially different in structure. – alexw Jun 23 '16 at 22:38
5

Use a branch, this is exactly what branches are designed for.

On the other hand, starting on a new dev branch seems less-than-ideal, because I will have to .gitignore a lot of untracked files from the old version to be able to easily switch between the two versions.

One possibility would be to have a branch in the GitHub repository, but clone that branch into a different working directory when you actually work on the code. That way the untracked files from one version won't be in the other version's working directory. If it is a complete rewrite where the configuration files will be incompatible, then this is a good way to go.

But, adding some additional lines to .gitignore in both branches to allow easy switching between them is pretty minor cost. If you want to be able to git checkout from one version to another, this is a pretty good route.

1

Maybe just use two folders old and new side by side. Since the new version appears to be completely source code incompatible you would not have any useful merge result anyway. It sounds like at some point you are going to just delete the old code and use the new code going forward.


Create an empty orphan branch

This is very comparable to the two folders solution but you indicated that you want to use both versions side by side.

You can probably make the orphan branch work for you as well by just having two working copies. Check out each of the two "epochs" into separate folders.

I hope what I said makes sense in a Git context. I'm more experienced with Subversion where such "low-tech" solutions are more common. In SVN branches are just folders anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.