一次使用多个分支的git [英] Using git with multiple branches at once

查看:128
本文介绍了一次使用多个分支的git的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我的设置 - 我有一个简单的git分支结构,master用于所有的分支开发和安装在客户端。由于客户端设置与我的设置不同,因此我在另一分支上有少量文件,名为my_company_name。例如,指定主机名的文件将在此类别中。



我想要做的是在master分支上工作,但从my_company_name获取特定文件。我知道我可以通过以下方式完成相同的操作:


  1. git checkout my_company_name

  2. git merge origin master

但我需要在每次推送时指定'origin master',否则这些文件将转至my_company_name。如果我做的是相反的话:


  1. git checkout master

  2. git merge origin my_company_name

然后,我需要在客户端安装之前在站点特定的文件中进行更改。



git如何支持此功能? 您可以使用 repo 来管理一个有少量git存储库的工作空间。


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?

解决方案

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

这篇关于一次使用多个分支的git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆