I’m curious if git will do the following.
I have a project which has been commited and contains JPGs a,b,c which are of Mt.Rushmore.
I now create a new branch of the project (2) and replace files a,b,c with new files which have the same names but are of Yellowstone Park and commit that.
My intention is to evolve both projects independent of one another even though in essence they are identical (they will most likely never change other than the creative JPG files that are associated with each).
Am I correct to assume that in switching branches I can expect the files to switch back and forth? And if so, what is the git specific command to have the relevant files deleted/downloaded from the repo as I move between the branches?
If this isn’t the right way to handle this, what is?
To be specific I have an Android project where the java code-base will likely never change but the layouts will have different art depending on various criteria and I would prefer not to split them up into two separate projects because they have the same package name and all that and it will become very messy.
Workflow you need looks like this:
By now you have
rushmorebranch containing Mt.Rushmore photos andyellowstonebranch that overrides these with Yellowstone Park photos. At any point you can usecheckout -b rushmoreto switch back and forth.This solution has one drawback: if you make some other changes to
rushmorebranch, you can merge them toyellowstonebranch by simply saying:However reverse operation will fail because Yellowstone photos will override Mt. Rushmore. Thus I believe a better approach would be to externalize these photos or commit both sets into separate directories. Have just one branch and at runtime (maybe using some configuration option) decide which photo set should be used.