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.
Well I ask myself if you even want to merge the changes or just get an exact copy of what the other person has done. You might also git reset --hard bitb/master
and your working tree will look perfectly the same as at the other person's computer. You will however lose commits you made since you gave the other person the code...