Git merge two repositories (ZZ)
转自 https://stackoverflow.com/questions/2428137/how-to-rebase-one-git-repository-onto-another-one
If A and B are not the same repo (you created B by using the latest working copy you had), you have to use a graft to pretend that they have common history.
Let’s assume you’ve added A as a remote for B as per VonC’s answer, and the repo looks like this1:
~/B$ git tnylog
* (HEAD, master) Latest work on B
* 799d6ae Imported backup from USB stick
~/B$ git tnylog A/master
* 33b5b16 (A/master) Head of A
* Initial commit
Create a graft telling the root of B that its parent is the head of A:
echo '799d6aeb41095a8469d0a12167de8b45db02459c 33b5b16dde3af6f5592c2ca6a1a51d2e97357060' \
>> .git/info/grafts
Now the two histories above will appear as one when you request the history for B. Making the graft permanent is a simple git filter-branch with no arguments. After the filter-branch, though, you aren’t on any branch, so you should git branch -D master; git checkout -b master.
1 git tnylog = git log --oneline --graph --decorate
补充句话:Git太厉害了!!!
Git merge two repositories (ZZ)的更多相关文章
- 聊下git merge --squash
你经常会面临着将dev分支或者很多零散的分支merge到一个公共release分支里. 但是有一种情况是需要你处理的,就是在你的dev的分支里有很多commit记录.而这些commit是无需在rele ...
- 分支合并git checkout adview git merge adview3
分支合并 git checkout adview git merge adview3
- [git]merge和rebase的区别
前言 我从用git就一直用rebase,但是新的公司需要用merge命令,我不是很明白,所以查了一些资料,总结了下面的内容,如果有什么不妥的地方,还望指正,我一定虚心学习. merge和rebase ...
- git merge 和 git rebase 小结
Git merge是用来合并两个分支的. git merge b # 将b分支合并到当前分支 同样 git rebase b,也是把 b分支合并到当前分支 ---------------------- ...
- Git merge 与 git rebase的区别
Git merge的用法: git merge Dev // Dev表示某分支,表示在当前分支合并Dev分支 git merge -m "Merge from Dev" Dev ...
- git merge 和 rebase 区别
git pull 超级不推荐使用git pull 有坑,谨慎使用,pull底层是merge git pull 是 git fetch + git merge FETCH_HEAD 的缩写.所以,默认 ...
- git merge之squash
看CM源码时,发现历史记录里有很多squash,于是google了解了一下. Git相对于CVS和SVN的一大好处就是merge非常方便,只要指出branch的名字就好了,如: 1 2 3 4 5 $ ...
- git merge 合并分支
git merge 用来做分支合并,将其他分支中的内容合并到当前分支中.比如分支结构如下: master / C0 ---- C1 ---- C2 ---- C4 \ C3 ---- C5 \ iss ...
- git merge
1. git 解决冲突 ***** <<<<<<< HEAD *** *** ======= **** **** ** >>>>> ...
随机推荐
- oracle 中的%type,%rowtype
oracle 中的%type,%rowtype1.使用%TYPE 在许多情况下,PL/SQL变量可以用来存储在数据库表中的数据.在这种情况下,变量应该拥有与表列相同的类型.例如,students表的f ...
- select * from sys.sysprocesses
MSDN:包含正在 SQL Server 实例上运行的进程的相关信息.这些进程可以是客户端进程或系统进程. 视图中主要的字段: 1. Spid:Sql Servr 会话ID 2. Kpid:Windo ...
- 正确看待POW与POS,总结与区分
POW:Proof of Work,工作证明. 比特币在Block的生成过程中使用了POW机制,一个符合要求的Block Hash由N个前导零构成,零的个数取决于网络的难度值.要得到合理的Block ...
- iOS:GitHub上值得关注的iOS开源项目
1.AFNetworking地址:https://github.com/AFNetworking/AFNetworking用于网络请求 2.JSONKit地址:https://github.com/j ...
- 数据实时分析平台 Heron
Twitter发布了新开发的数据实时分析平台Heron,以下为官方文档摘译: 我们每天在Twitter上处理着数十亿的事件.正如你猜测的那样,实时分析这些事件是一个巨大的挑战.目前,我们主要的分析平台 ...
- 【千纸诗书】—— PHP/MySQL二手书网站后台开发之知识点记录
前言:使用PHP和MySQL开发后台管理系统的过程中,发现有一些通用的[套路小Tip],这里集中记录一下.结合工作中ing的后台业务,我逐渐体会到:除了技术知识外.能使用户体验好的“使用流程设计”积累 ...
- 【招聘App】—— React/Nodejs/MongoDB全栈项目:socket.io&聊天实现
前言:最近在学习Redux+react+Router+Nodejs全栈开发高级课程,这里对实践过程作个记录,方便自己和大家翻阅.最终成果github地址:https://github.com/66We ...
- mybatis 一对多
person package com.kerwin.mybatis.pojo; import java.util.List; public class Person { private int id; ...
- JAVA实现https单向认证
//关于http 须要两个jar包 httpclient-4.0.jar httpcore-4.0.1.jar private static final HttpClient httpClient = ...
- 爪哇国新游记之十九----使用Stack检查数字表达式中括号的匹配性
/** * 辅助类 * 用于记载字符和位置 * */ class CharPos{ char c; int pos; public CharPos(char c,int pos){ this.c=c; ...