Merge git repo into branch of another repo
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的更多相关文章
- git pull的时候提示git pull <remote> <branch>
yuanqiao@yuanqiao-PC MINGW64 /h/WorkSpace/git/dadeTest (dev)$ git pullremote: Enumerating objects: 7 ...
- git merge & git rebase
git merge & git rebase bug error: You have not concluded your merge (MERGE_HEAD exists). hint: P ...
- 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 ...
- git clone all branch and create a empty branch
/******************************************************************** * git clone all branch and cre ...
- git clone指定branch或tag
git clone指定branch或tag发布时间:October 28, 2018 // 分类: // No Comments 取完整: git clone https://github.com/a ...
- Git Step by Step – (2) 本地Repo
前面一篇文章简单介绍了Git,并前在Windows平台上搭建了Git环境,现在就正式的Git使用了. Git基本概念 在开始Git的使用之前,需要先介绍一些概念,通过这些概念对Git有些基本的认识,这 ...
- 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 ...
- git merge 到 非当前 branch
1. Add a remote alias for your local repository, ex: git remote add self file:///path/to/your/reposi ...
- git学习之branch分支
作为新手,站在我的角度肤浅的来理解,分支就是相当于开辟了一个新的临时工作区,在这个工作区进行文件代码改动,然后在合并到master主工作区,这样能保证主工作区的安全性和稳定性,对于团队协作尤为重要. ...
随机推荐
- 用xshell 连接docker Linux服务器
用xshell 连接docker Linux服务器
- iOS 设计模式-Block实现代理的逻辑
在A页面,点击跳转到B页面,B页面操作完,回到A页面,并刷新A页面的内容.典型的例子,就是在一个列表里,点击新增,跳到新增页面,新增完,把数据传回给列表页,并刷新列表页里的内容. 这个,我平时一般是通 ...
- color xml arm相关
#-------------------------------------------------------------------------- # C O L O R S #--------- ...
- vue中上传图片至阿里云oss
1.开通阿里云的oss服务这些这里就不多做介绍了 2.登入阿里云的后台管理系统创建一个Bucket 3.在后台管理系统中进入访问控制 4.点击用户管理->新建用户->填写相关信息,就生成了 ...
- Lambda表达式语法2
package airycode_java8.nice3; import airycode_java8.nice1.Employee; import org.junit.Test; import ja ...
- Rstudio 01 连接MySQL
> install.packages("RMySQL") also installing the dependency ‘DBI’ trying URL 'https://c ...
- Excel的导入导出功能
POI组件的详细介绍文档: https://www.cnblogs.com/huajiezh/p/5467821.html .xls 对应 HSSFWorkbook book=new HSSFWork ...
- html5-相对定位
*{ margin: 0px; padding: 0px;}div{ width: 300px; height: 300px;}#div1{ background: rg ...
- ASCII 码
http://baike.baidu.com/link?url=Y4crTsVq678Z8fr92DAGIrqVHoexVXsMc-WKBMVUKGDq4KbEOuhWbUQXuQEtnlom4yln ...
- Python 连接SQL Server数据库 - pymssql使用基础
1. 官方api http://www.pymssql.org/en/stable/ref/pymssql.html 我学习自这里