[英]Push to a new git after rebase
I have an existing git repo and I want to push all hashes(commits) from existing git repo to a new git repo that already has at least one hash(commit). 我有一个现有的git repo,我想将所有哈希(提交)从现有的git repo推送到一个已经至少有一个hash(commit)的新git repo。 So I would like to do the following: 因此,我想执行以下操作:
What are the exact git commands I need to do in sequence? 我需要按顺序执行哪些确切的git命令?
I will assume that you will deal with possible rebase problems yourself 我假设您将自己处理可能的基准问题
I will assume that there is at least one common ancestor suitable as a merge base , otherwise you will have to deal with this problem before following these steps 我将假定至少有一个共同祖先适合作为合并基础 ,否则在执行这些步骤之前,您将不得不处理此问题。
I will add some intermediate steps to your proposed approach 我将在您建议的方法中添加一些中间步骤
new-repo
) to the old-repo
将远程仓库( new-repo
)添加到old-repo
new-repo
new-repo
获取数据 master
branch onto the master
branch from new-repo
(proceed with other branches in a similar fashion) 变基master
分支到master
从分支new-repo
(与其他分支继续以类似的方式) new-repo
repository 将更新的分支推送到new-repo
仓库 Question you might want to answer beforehand: 您可能需要事先回答的问题:
Add new-repo
as remote 将new-repo
添加为远程new-repo
$ git remote add new-repo <url-to-new-repo>
Fetch data of new-repo
提取new-repo
仓库的数据
$ git fetch new-repo
Rebase master
(current branch and up-to-date) of old-repo
onto master
of new-repo
将old-repo
仓库的master
(当前分支和最新)重新建立到new-repo
master
上
$ git rebase new-repo/master
Push to new-repo
推送到new-repo
$ git push new-repo master:master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.