如何合并codeline与git [英] How to merge codeline with git

查看:142
本文介绍了如何合并codeline与git的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个改编号为A的代码行,我在其上编辑了一些文件,然后添加 p4打开通过 git add ,然后将 git commit 添加到我的本地存储库中。 b

还有另外一个工作在SAME代码行上的变化编号为B的人。他还编辑了一些文件,其中一些是我们之间的通用文件,他也做了 git init git add git commit 到他的本地存储库。



首先我们没有中央全球回购协议。但是现在我想将他的git更改合并到我的客户端中。这怎么能通过git完成?

  myGitCodeLine ------? 

hisGitCodeline ------ /


解决方案首先,你需要某种访问他的回购。一个简单的共享目录就足够了。 此处详细介绍其他选项



然后你需要克隆他的回购(B)以获得所有的变化。
您可以在自己的仓库中创建一个分支A,并通过第二个仓库B添加所有检出的项目。

这样做的一个诀窍是:


  • 在您的仓库中创建第二个根分支(以便从空白内容开始)

    git checkout - 孤儿branchForB :参见这个SO回答作为示例。使用 - work-tree =< path> 选项来添加文件其他目录:

    git --work-tree = / path / to / file add。,如



完成后:


  • 您可以将第二个分支合并到您的主分支中。

  • 您需要向B请求c只有您的回购A才能让您从一个共同的历史中获益。


I have a codeline with certain change number A. I git init on it and I edit some files and then add p4 opened files by git add and then git commit to my local repository.

There's another guy working on the SAME codeline with different change number B. He also edited some files, some of which are common files between us and he also did the git init, git add and git commit to his local repository.

We don't have a central global repo in the first place. But now I want to merge his git changes into my client. How can this be done via git?

myGitCodeLine------?

hisGitCodeline------/

解决方案

First you need some kind of access to his repo. A simple shared directory is enough. Other options are detailed here.

Then you need to clone his repo (B) in order to get all the changes. You can make a branch in your own repo A, and git add everything checked out by the second repo B.
A trick to do that easily is to:

Once that is done:

  • you can merge that second branch into your main branch.
  • you need to ask B to clone your repo A in order for you both to work from a common history.

这篇关于如何合并codeline与git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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