git 两个repo merge

You can't merge a repository into a branch. You can merge a branch from another repository into a branch in your local repository. Assuming that you have two repositories, foo and bar both located in your current directory:

$ ls
foo bar

Change into the foo repository:

$ cd foo

Add the bar repository as a remote branch and fetch it:

$ git remote add bar ../bar
$ git remote update

Create a new branch baz in the foo repository based on whatever your current branch is:

$ git checkout -b baz

Updated with "real-life" commands:

Start from your repo directory, make sure your working copy is clean (no files changed, added or removed).


Make a new branch:

git checkout -b <my-branch>

Add the secondary remote, then fetch it:

git remote add <repo-name> git@github.com:xxx/<repo-name>.git
git remote update

Merge one of their branches in your current branch:

git-merge <repo-name>/<their-branch>


If you don't know which <their-branch> you want, then go for master

If you are sure you want to accept all remote changes and avoid conflicts (overwrite yours) then you can specify -X theirs as option for git merge in the last step.

If you want to add it in a subdirectory then probably you should probably use git submodules

Merge branch somebranch from the bar repository into the current branch:

$ git merge bar/somebranch

Merge git repo into branch of another repo的更多相关文章

  1. git pull的时候提示git pull <remote> <branch>

    yuanqiao@yuanqiao-PC MINGW64 /h/WorkSpace/git/dadeTest (dev)$ git pullremote: Enumerating objects: 7 ...

  2. git merge & git rebase

    git merge & git rebase bug error: You have not concluded your merge (MERGE_HEAD exists). hint: P ...

  3. spark mllib配置pom.xml错误 Multiple markers at this line Could not transfer artifact net.sf.opencsv:opencsv:jar:2.3 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org

    刚刚spark mllib,在maven repository网站http://mvnrepository.com/中查询mllib后得到相关库的最新dependence为: <dependen ...

  4. git clone all branch and create a empty branch

    /******************************************************************** * git clone all branch and cre ...

  5. git clone指定branch或tag

    git clone指定branch或tag发布时间:October 28, 2018 // 分类: // No Comments 取完整: git clone https://github.com/a ...

  6. Git Step by Step – (2) 本地Repo

    前面一篇文章简单介绍了Git,并前在Windows平台上搭建了Git环境,现在就正式的Git使用了. Git基本概念 在开始Git的使用之前,需要先介绍一些概念,通过这些概念对Git有些基本的认识,这 ...

  7. Git: untrack a file in local repo only and keep it in the remote repo

    You could update your index: git update-index --assume-unchanged nbproject/project.properties and ma ...

  8. git merge 到 非当前 branch

    1. Add a remote alias for your local repository, ex: git remote add self file:///path/to/your/reposi ...

  9. git学习之branch分支

    作为新手,站在我的角度肤浅的来理解,分支就是相当于开辟了一个新的临时工作区,在这个工作区进行文件代码改动,然后在合并到master主工作区,这样能保证主工作区的安全性和稳定性,对于团队协作尤为重要. ...

随机推荐

  1. Keras学习率调整

    Keras提供两种学习率适应方法,可通过回调函数实现. 1. LearningRateScheduler keras.callbacks.LearningRateScheduler(schedule) ...

  2. response.sendRedirect(url)与request.getRequestDispatcher(url).forward(request,response)的区别

    response.sendRedirect(url)跳转到指定的URL地址,产生一个新的request,所以要传递参数只有在url后加参数,如: url?id=1.request.getRequest ...

  3. arcgis api for flex 开发入门

    参考:http://blog.sina.com.cn/s/articlelist_2346836525_1_1.html 参考教程:https://www.jb51.net/books/81280.h ...

  4. 24.form表单提交的六种方式

    form表单提交方式 1.无刷新页面提交表单 表单可实现无刷新页面提交,无需页面跳转,如下,通过一个隐藏的iframe实现,form表单的target设置为iframe的name名称,form提交目标 ...

  5. PO模型

    大神绕道而行,自我小白的笔记,仅此 一.创建文件夹,创建xxx.ini文件用来存放界面的定位元素,用 [界面_element]-->界面, 来划分界面界面元素,维护方便.定位元素的格式:  us ...

  6. Lambda表达式语法

    基础语法:‘->’Lambda操作符* 左侧:Lambda表达式的参数列表 对应接口中方法中的参数列表中的参数(比如nice1中MyPredict这个接口中的方法)* 右侧:Lambda表达式中 ...

  7. ArrayList与List性能测试

    理论:由于ArrayList存储数据存在装箱(读取数据存在拆箱),而泛型List<T>直接对T类型数据进行存储,不存在装箱与拆箱拆箱操作,理论上速度应该快一些. 废话少说,上代码. pub ...

  8. Azure IoT 技术研究系列2-设备注册到Azure IoT Hub

    上篇博文中,我们主要介绍了Azure IoT Hub的基本概念.架构.特性: Azure IoT 技术研究系列1-入门篇 本文中,我们继续深入研究,做一个起步示例程序:模拟设备注册到Azure IoT ...

  9. python 测试文件或者文件目录是否存在 测试文件类型,获取文件大小,获取修改日期

    ----测试一个文件或目录是否存在 >>> import os >>> os.path.exists('/etc/passwd') True >>> ...

  10. mybatis源码解析8---执行mapper接口方法到执行mapper.xml的sql的过程

    上一篇文章分析到mapper.xml中的sql标签对应的MappedStatement是如何初始化的,而之前也分析了Mapper接口是如何被加载的,那么问题来了,这两个是分别加载的到Configura ...