version control - git - merge two divergent branches ignoring some directories -


short story: want tell git ignore directory when merging. know git doesn't work way...

long story: have project deployed on 2 different platforms. every platform needs tweaks code deploy.

i have 2 branches, 1 every platform: platforma , platformb. 2 branches practically identical. difference in couple of files , directory needs present on 1 platform not on other. scenario:

platforma branch:  - dir1    - file1  - dir2    - file2  platformb branch:  - dir1    -file1 

the problem appears when i'm working on platforma , make changes file1. want these changes available on platformb. problem when merge, git adds dir2 , file2 platformb.

i want able work on platformb , make changes file1 , able merge platforma without git removing dir2 , file2.

so question is: there way have 2 mergeable divergent branches? or there way tell git ignore directory/commit?

i have tried solution works when merging projectb->projecta, not other way around (git copies dir2 , file2 onto projectb).

also, think can cherry-pick every time, seems cumbersome , prone erros.

thanks in advance!

i recommend not use branches platform specific files. reorganize project platforms in single directory tree , common files present once.

like linux kernel - has arch directory platform-specific code, not bunch of branches.

what happens when need develop new feature that's larger 1 commit? create branches platforma-coolfeature , platformb-coolfeature? merge hell :)


Popular posts from this blog