0

Does git support a view where different files come from different branches?

Here is my setup -- I have a simple git branch structure with master being used for all development and installs at the client site. Since the client setup is different from my setup, I have a small number of a files on a different branch, called "my_company_name". Files that specify hostnames, for example, would be in this category.

What I'd like to do is work on the master branch, but get specific files from my_company_name. I understand that I could accomplish the same thing by:

  1. git checkout my_company_name
  2. git merge origin master

but I would need to specify 'origin master' each time I push, or the files will be going to my_company_name. If I do the opposite:

  1. git checkout master
  2. git merge origin my_company_name

then I would need to make changes in the site-specific files before installing at the client site.

How does git support this?

Riothamus
  • 71
  • 1
  • 4
  • 1
    Not an answer, but it would be very trivial to write a script to check the current branch and do that for you then you can add it as an alias. – OneOfOne Aug 22 '12 at 23:03

2 Answers2

1

You can use repo to manage a work space with a few git repositories.

auselen
  • 27,577
  • 7
  • 73
  • 114
0

You should look at smudge/clean scripts instead of branches for this. See the git attributes chapter in the progit.org/book. Or just use plain scripts.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141