Could anyone please guide me on how to correctly apply git to an Android Project with multiple Product Flavor and Dimension.
I could simple add a Git to the whole project but would that be the right way to do it?
EDIT:
Lets say I'm building a Store Application.
I would have the following configuration
flavorDimensions "client", "network" productFlavors { client1 { dimension "client" ... }
client2 {
dimension "client"
...
}
prod {
dimension "network"
...
}
debug {
dimension "network"
...
}
}
The result product flavors would be sharing a same "Code Base" (since they are both a Store Application) but they would also need to have individual Iteration/Version releases/features.
One way I think about doing this (and the only way I know doing it) is to simply add the Git to the whole project. Create a branch for the product flavor and go on from there. Only problem is when i do some changes to the "Base Code" I would have to cascade it to some if not all of the branches.
My question is if this is the correct way of doing this.
Thanks in advance.
You can use any of below options:
Assume you manage 2 projects in the same branch, you can use tags to assist to manage different projects versions separately: version format A*.*.*
(such as A1.0.0
) for project1 and version format B*.*.*
(such as B1.0.0
) for project2.
To add a tag for HEAD:
git tag -a <version> -m 'message'
To add a tag for a history commit:
git tag -a <version> -m 'message' <commit>
You can manage each project in different branches so that you can manage and track the versions for different projects separately.
And if the "code base" changes in one branch, you can apply the changes into other branches.
To apply a file from a branch (such as branchA
) to another branch (such as branchB
), you can use below commands:
git checkout branchB
git checkout branchA -- filename
git commit -m 'apply the changes of the filename from branchA into branchB'