How to use GIT to track a slightly different version of the project?
What would be the best approach to 开发者_Go百科track a slightly different version of the project in the same repository?
The differences would be in couple of functions, and 99% of the code would be the same?
Probably the easiest would be to store your changes in a separate branch.
So basically have your main project in the 'master' branch and the other version in another branch. Name it related to what it is so you don't get confused.
When doing updates, do everything through master (unless updates are specific to that separate branch) and then merge master into it to keep it updated.
There are a number of ways to do it. But I think the easiest would be to probably have one branch that is where most of the development is done. Then have one "slightly different" set of code in a second branch where the only changes are the "differences that should be different" (ha). Every so often, rebase the slightly different branch to the top of the main branch.
You could also do it with 3 branches, common changes in one branch that get merged into the other two, etc. But I think the above is easier.
You will need to initially merge from one branch to the other with an "ours" merge strategy. This will ensure that the difference does not get merged into the original branch when you do back merges.
Hope this helps.
精彩评论