从Bitbucket导入提交到现有的Gitlab回购 [英] Importing commit from Bitbucket to Existing Gitlab repo

查看:584
本文介绍了从Bitbucket导入提交到现有的Gitlab回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我将代码交给了另一个人,他们已经完成了一些重要的工作来完成这项工作。它将它存储在Bitbucket上。



现在我想把这个人的代码添加到我现有的Gitlab仓库中(作为新的提交)。我该怎么做?



我正在使用Windows。



谢谢

编辑:你有不正确的路径。

解决方案

最简单的方法是使用Git bash msysgit提供。



您可以设置多个来源,并且可以将其分支与当前工作树合并。我假设其他人只改变了他的主分支。



第一
将另一个存储库设置为另一个远程存储:
git remote add bitbhttps:// bitbucket .......



然后
从这个远程
获取更改git fetch bitb master



现在您必须决定
$ b

a)通常情况下(简单的git方式)你将另一个分支合并到你的主分支中
git merge bitb / master



他的所有提交并将它们与 master 中的更改合并。您的存储库也将保持兼容,以便进行未来的协作。



b)我不认为您真的想将所有更改压缩到一个提交和合并在这种情况下,你丢失他所有的笔记和简单的修改以及你的版本库的兼容性。

如果你真的想那么你可以切换到他的分支( git checkout bitb / master )并使用 git rebase -i master 来压扁所有他的提交,因为他从主分离成一个单一的提交,切换回主( git checkout master 并合并单个提交到您的主( git合并bitb / master



考虑保持简单的原则并选择第一个选项。


I am working on this large project and my source code is being stored on Gitlab.

I gave the code to another person and they have done some major work to it and they store it on Bitbucket.

Now I want to take the person's code and add it to my existing Gitlab repo (as a new commit). How can I do that?

I am using Windows.

Thanks

Edit: You have unmeged paths.

解决方案

The easiest way to this is by using the Git bash that msysgit provides.

You can setup multiple origins and you can merge their branches with your current working tree. I assume the other person made only changes his master branch.

First setup the other repository as another remote: git remote add bitb "https://bitbucket......."

Then fetch the changes from this remote git fetch bitb master

And now you have to decide

a) Usually (the simple, git-way of doing things) you merge the other branch into your master branch git merge bitb/master

This way you preserve all his commits and merge them with your changes in master. Your repositories will also stay compatible together for future collaboration.

b) I don't think you really want to squash all his changes into one single commit and merge this in which case you lose all his notes and simple changes and the compatibility of your repositories.

If you really wanted to do so you could switch to his branch (git checkout bitb/master) and use git rebase -i master to squash all his commits since he diverged from master into one single commit, switch back to master (git checkout master and merge the single commit to your master (git merge bitb/master)

Think about the Keep-it-simple principle and select the first option.

这篇关于从Bitbucket导入提交到现有的Gitlab回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆