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. GO language for windows

    我记得我们已经下载完成了windows 下Go 的安装包 go1.9.windows-amd64.msi下面接着说吧 GO 在Windows 上也是按照linux 惯例来编程的,所以,你还需要一个wi ...

  2. (转载)Spring定时任务的几种实现

    spring框架定时任务 一.分类 从实现的技术上来分类,目前主要有三种技术(或者说有三种产品): Java自带的java.util.Timer类,这个类允许你调度一个java.util.TimerT ...

  3. iOS 新浪微博-3.0 新特性

    每个程序在第一次启动的时候,都会显示新特性.效果如下: 思路: 添加一个ViewController,里面放两个View,一个是UISrollView,另一个pageControl 往UISrollV ...

  4. iOS UI进阶-2.0 CALayer

    在iOS中,你能看得见摸得着的东西基本上都是UIView,比如一个按钮.一个文本标签.一个文本输入框.一个图标等等,这些都是UIView 其实UIView之所以能显示在屏幕上,完全是因为它内部的一个图 ...

  5. flask orm

    #查询        #查第一行    session.query(User.id,User.userName,User.password).first()        #查所有行    sessi ...

  6. java中的锁之AbstractQueuedSynchronizer源码分析(二)

    一.成员变量. 1.目录. 2.state.该变量标记为volatile,说明该变量是对所有线程可见的.作用在于每个线程改变该值,都会马上让其他线程可见,在CAS(可见锁概念与锁优化)的时候是必不可少 ...

  7. tensorflow tensor 索引

    问题: self.q_eval4next: (100,2) ix=[0,1,0,1---0,1](100,1) 我想取q_eval4next[:,idx] #use_doubleQ 切片用!!!! s ...

  8. 如何修改Xampp服务器上的mysql密码(图解)

    https://www.jb51.net/article/111289.htm https://www.cnblogs.com/Leequik/p/5323795.html 1.点击MySQL的adm ...

  9. 分布式系统ID生成方案

    自增ID 不错,可以限度抑制ID的大小.但需要有一个中心化的节点作为解决原子性问题.可以选用Redis,MySQL,Zookeeper.成本有点高. UUID 分布式,而且唯一!缺点是生产的ID太长. ...

  10. redis相关问题

    什么是Redis?Redis 是一个使用 C 语言写成的,开源的 key-value 数据库..和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表 ...