开发者

Branch from *part* of main code, how to keep it up to date?

Was little bit difficult to formulate the title for my question since is kind of abstract...

Let me try to explain. I have a main code which has a git repository, I decided to take part of that code and make it a stand alone app. with its own name and versions to be distributed.

Is there a way to keep the main code and that other bran开发者_运维问答ch updated? ex. If I find a workaround for that code on Main, if I can merge that change to the stand alone (without adding any of the other functionality) as well as if I add a new feature on the stand alone, I would like to apply it to the main code as well.

Currently I have a branch but Im not sure If I will create its own git repository soon.

I am aware of git add -p but some times i have to many changes and going 1 by 1 until I arrive to the one I want to apply is sometimes a pain.

Any info would be appreciated


The tool most like what you describe is an add-on to Git, known as git-subtree:

http://github.com/apenwarr/git-subtree/blob/master/git-subtree.txt

It works a bit like submodules, but the projects aren't actually linked together, and you can extract and re-merge as much as you like. There are ongoing discussions regarding whether this tool will soon be distributed with Git itself.


I believe what you want is in fact similar to a partial clone, for which is not supported in GIT.

Either put that "part" into a separate repository and make use of submodule, or create a branch for the standalone app and delete all unused stuff.


You can use git cherry-pick to grab individual commits and merge them into your current branch. Might be kind of annoying for long-running development, but it's one possible solution to your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜