views:

49

answers:

3

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 branch 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

+1  A: 

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.

Adrian Shum
A: 

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.

mipadi
+2  A: 

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.

cxreg
I think this is exactly what I was looking for. Thanks
RaptorX