How to organize my openHAB setup with multiple git repos?

After a bit of googling and phrasing my idea in different ways this stackoverflow post gave me the right input how to use branching and only one repo instead of trying to violate git :sweat_smile:

More detailed:

  1. Create an new repo (new folder, git init)
  2. Commit all files and folder marked above as ‘shared’ (git add . & git commit -m “create common”)
  3. Rename branch master to common ( git branch -m master common)
  4. Create and checkout branch serverone ( git checkout -b serverone)
  5. Commit all files & folders unique to server one
  6. Checkout branch common (git checkout common)
  7. Create and checkout branch servertwo
  8. Commit all files & folders unique to server two

A few tipps:

  • you can use git log --oneline --decorate --graph --all to get an ‘graphical’ overview in your shell about your branches and commits
  • if you do changes to your common files use git checkout serverone (or …two) and git merge common to merge the changed common files back into your server branches

Source: Pro Git, Chapter Branching

1 Like