0

I am collaborating with others on code which is version controlled by git. My colleagues have a different version of the environment version from myself, which causes problems for me trying to compile their code directly. I cannot easily upgrade to their version of the environment.

However, it turns out not to be a problem, as a quick and dirty hack, to place the relevant include/setup files in the relevant directory to be able to compile.

I'd like to be able to edit the joint code together with the "hacky" nonstandard setup in a separate git branch, but only push the main code (without the setup/include files which my colleagues should not have to worry about) to the main branch.

I am aware that I could, as a one-off solution, concentrate the setup file additions into a particular part of the history tree and rebase only the part of the history tree which does not contain these additions onto a branch that then gets pushed to master. However, this is a very unstable solution, as I have to keep track of the relevant commits, and in addition I have to do this every time I push to master. Since this is a repeated operation, I am wondering whether there is a proper git idiom or practice which should better be used for such a case.

This question is related, but not identical to the following:

Branch-specific configuration file maintenance with git

1 Answers1

1

Would it be feasible for you to add your config files to your local's .git/info/exclude (or another local-only .gitignore equivalent)?

This isn't a particularly robust solution, but it should prevent you from inadvertently adding those files to any changes you push upstream.

Chris Keefe
  • 797
  • 7
  • 17
  • This looks like a suitable workaround indeed. Perhaps it is even closer to the philosophy of git that, ultimately, all that is checked in should at least have the potential to become a part of master (which clone-local changes shouldn't). Although it was not precisely my request, it might be a good intermediate solution. +1 – Captain Emacs Feb 10 '19 at 10:18