Take the 2-minute tour ×

When setting up a dotfiles repo for several different platforms (eg. OS X, linux and Cygwin) would it be best to create branches for each machine type, or to use separate projects?

Many of the files will be the same, but some will have minor differences.

I tried creating branches off of my master, but pushing to the remote repo led to things like:

Your branch and 'master' have diverged,
and have 4 and 1 different commit(s) each, respectively.

I don't understand why my "Cygwin" branch is reporting its out of sync with master. It's a branch -- it's supposed to be different that the master.

Any suggestions of the best practice to accomplish my goal.

Thank You.

share|improve this question
Could you show us the (branch) setup of your remote repo, and the command you've used to push to it? –  Bergi Aug 4 '12 at 22:03
Is it possible to nail the difference in files down to one directory/module of the software? –  Lukas Knuth Aug 4 '12 at 22:07
Thanks, I was getting the above message because I was tracking a remote branch unintentially. I disabled tracking per instructions and the message has been resolved. I like the idea of using conditional #include or #define statements. One of the files that varies from platform to platform is actually .gitconfig. Is there a way to use conditional statements in the .gitconfig file? –  GrowlTiger Aug 7 '12 at 20:49

1 Answer 1

up vote 1 down vote accepted

The diverged message means that you have a tracked branch. You could disable tracking, see here how.

However, I don't think that the way you are using branches for multiplatform builds is correct. Better if you will have platform-dependent stuff separated by the code, e.g. by using conditional #includes, #defines or build scripts.

share|improve this answer
That solved my problem! I also made use scripts to point to various platform specific .dotfiles, such as .gitconfg. I now have a .gitconfig.CygWin, .gitconfig.osx, and .giconfig.gentoo in my /dotfiles directory. I use a setup script to detect the platform and create a symbolic link in my home directory pointing to the proper .gitconfig file. –  GrowlTiger Jan 27 '13 at 3:40

Your Answer


