问题
I need to use 3rd-party code that's available publicly on github. I'm looking at the github's network graph of that code and I can see that other forks have some commits that aren't merged into the original repository.
How should decide which of the branches/forks is right for me?
Please enlist your considerations while facing a problem like this.
As suggested by John Feminella, one should always use the (usually stable) 'released versions of a project'.
I agree with that of course, but this question is still relevant in one of the following cases:
- The original author no more maintain that code.
- There is a feature I need that isn't implemented in the original but implemented differently in more than one fork
- The code is still under development stages, each fork has some differences from the original (either in features, or development decisions and implementation)
I've faced such a case many times, currently the original author still tries to keep the repo maintained but it seems that he doesn't have enough time, other forks are more active. None of the forks is announced as stable enough for production use. Last time I faced such a case the original repository also didn't implemented a feature that was important for me.
So in such cases I would need to choose the most stable fork, try using it within my code, test it thoroughly and possibly contribute some improvements in order to make it stable.
回答1:
Update: The OP clarified his original question to indicate that the project in question is dead.
Given that a project is dead and that it has N forks, the usual strategy for picking the "best fork" depends on a number of factors:
Has anyone announced that they're taking over maintenance of the project? Search for news on the mailing lists, public forums, et cetera (not just on GitHub). If so, start following that fork.
Are there forks on the network graph that have commits coming from another fork (rather than, say,
master
)? If so, that indicates support is coalescing around this other fork as a possible replacement for the dead project.If either of these don't work, do some more digging: Are there variants of the project that split off some time ago and around which support is now organizing? If so, maybe that other project will suit your needs.
Failing all that, sometimes projects just don't have the support to keep going. If so, perhaps it's time to scratch your own itch!
Original answer:
A few comments on this:
In general, you should use released versions of a project, rather than choosing a particular fork or branch. If you don't, your dependencies will change every time the project updates with a new commit, which could lead to difficult-to-find bugs in your own code.
If you decide you always want the latest version and you're okay with the risks of that, then use the project's
master
branch, because that's the official one. That'll be the default branch you're looking at when you visit the repository's main page.People usually fork repositories to make and solicit feedback on some kind of modification to the original codebase.
So, unless you're collaborating on that modification, or unless you have a particular interest in getting early access to that specific modification, you don't need to worry about the other forks.
On rare occasions, a project's official mainline development branch will be called something other than master
. In that case you should consult the README to see which branch you should look at.
回答2:
To complete John's answer.
I'm using http://gitpop.heroku.com which is useful for finding most popular & active forks. It's quite rudimentary, but it does the work.
Edit: As in March 2014, GitPop is broken so I wrote my own because it was useful to me. http://gitpop2.herokuapp.com
来源:https://stackoverflow.com/questions/10372063/how-to-choose-the-right-branch-fork-to-use-by-looking-on-the-githubs-network-gr