对于我开发的每个 Arduino 项目,我都有单独的 GIT 存储库,我使用连接到 Bitbucket 中的远程存储库的 SourceTree 来处理这些项目。
我想知道如何将这些存储库 merge 为一个并保存每个文件的历史更改。
是否可以在 SourceTree 中完成?我还没有通过命令行使用过 GIT。
最佳答案
您可以在 BitBucket 中创建一个新的 git 存储库,克隆它并将您现有的两个 bitbucket 存储库添加为 submodules 这个新的 repo 。
使用 Sourcetree(自 2012 年起及其 1.3 版本),这很容易。
You’ll then be prompted to provide a source URL to clone the contents from, and the path within the current repository that this submodule will reside.
一旦你对这些子模块中的任何一个进行了更改,你就可以推送所有内容(子模块,还有记录 gitlinks , special entries in the index 的父 repo)
(此屏幕截图适用于 mercurial 存储库,但对于 git 存储库同样有效)
另一种选择是 git subtree
, illustrated here ,这differs from submodule .
尽管 git-subtree.sh add --prefix/url/to/repo.git master --squash
将通过压缩 vim-surround 存储库的整个历史来记录 merge 提交 merge 为一个,subtree push
仍会将 bash 的额外历史推送到您的原始子树存储库,从而保留并完善其历史。
关于git - 使用 SourceTree 将两个 GIT 存储库 merge 为一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33069694/