[英]How to rewrite the master branch history to other Repository master branch
Is there any way or any tool or commands to re write the history of master
or some A
branch from some commit number to newly created master
branch of NEW REPOSITORY with master
branch with 0 commits or no history. 是否有任何方式或工具或命令来重新书写的历史master
或一些A
分支从一些承诺数新创建的master
新的存储库的分支与master
分支0提交或没有历史。
In such a way that : 以这种方式:
Thanks 谢谢
(I don't have a suitable sacrificial repository to test this: you've been warned). (我没有合适的牺牲品库来测试这一点:已警告您)。
I would think merge --squash
could do this. 我认为merge --squash
可以做到这一点。
Merge --squash
from your source branch 从源分支Merge --squash
(See this answer as well.) (也请参阅此答案 。)
Old Content (before question edit) 旧内容(问题编辑之前)
Just create the new repository as a new remote on your clone of the original repository; 只需在原始存储库的克隆上将新存储库创建为新的远程目录即可; and then push to the new repository. 然后推送到新的存储库。
git remote add newrep url-to-new-repository
git push -u newrep master
Repeat the last command for each branch you want to push. 对要推送的每个分支重复最后一个命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.