0

I maintain a code base that is targeted for 2 hardware devices. These versions differ in some hardware specific and feature specific ways. This variation might be around 3-4 % of the code base. Should I maintain this as 2 branches of the same repo or as two different repos. I am using git

kiran
  • 485
  • 1
  • 8
  • 24
  • 1
    I feel like this question is ultimately [opinion based](https://meta.stackoverflow.com/questions/255468/opinion-based-questions). – Daemon Painter May 06 '20 at 07:56

2 Answers2

0

I would create a branch with only common code, then create 2 branches from that branch (one for each hardware, with changes only being acceptable in their own dedicated folders).

If working on common code, go on the common code branch (say develop or master). If working on hardware-specific code, checkout to that branch and rebase against the common code branch, then add your new commits, push to remote and leave it at that.

You'll essentially have 1 branch for common code which will be used by the hardware branches to get current business logic version without interacting with each other or changing it.

Hope it helps!

Jeremi G
  • 397
  • 1
  • 8
0

I would keep all the code under the same branch.

There are quite a load of difficulties with preserving two production branches :

  • you have to merge/rebase twice,
  • that's twice the burden when handling conflicts,
  • you can find yourself with differences in the code that should be common,
  • it gets harder to identify what is the production version,
  • etc ...

Differences with architecture can be represented in the file structure, the code itself and the build scripts (compilation options, etc ...)

LeGEC
  • 29,595
  • 2
  • 37
  • 78