简体   繁体   中英

Using git with multiple branches at once

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?

您可以使用repo来管理带有几个git存储库的工作空间。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM