Bitbucket to github migration of an already existing repo - github

we have migrated from bitbucket to github 4 months ago but our team members are still using bitbucket. So, now we have decided to completely moved to Github and use its sevices. So, i want to know whether we can still use mirroring or not to migrate all the changes in bitbucket to github or we have to push it manually or using git push --all.

It depends if there was concurrent activity both on GitHub (the new repository) and BitBucket (the old one)
If that is the case, I would prefer asking each developer, in their own local repository, to:
add the new repository as a remote 'gh'
fetch from it
rebase their branch on top of gh/their-branch (for branches that were modified both on GitHub and BitBucket)
push new branches (done only on BitBucket)
That way, each developer can resolve any conflict locally first, before updating the new GitHub repository.

Related

"Disconnect" forked Git repos in VSTS

In VSTS, I forked a repository to develop a separate product from the original repo.
When I make a PR from a branch into master in my forked repo, VSTS defaults to merging into the original repo. I have to be sure not to mistakenly merge into the original repo with every PR.
VSTS seems to think that I may want to merge changes from my forked repo into the original one. I have no plans to do so. How do tell VSTS to 'disconnect' my forked repo from the original?
No, there isn’t such feature in VSTS, there is the user voice that you can vote: Allow option of converting forks to repos
Work-around
As a work-around (in Visual Studio) until it's fixed:
Pull the repo.
Delete the remote repo.
Create a new remote repo with the same name.
Push the repo.
You might have to create a temporary remote repo (named temp if you'd like) in order to be able to delete the remote repo. You can delete the temporary remote repo, named "temp", after you've pushed to the new remote repo.
You'll most-likely break anything (pull requests, work items) linked to the repo and also have to re-apply any policies and security stuff.
repo = the faulty fork in VSTS.
temporary remote repo = a temporary tepo created if you cant delete the fork repo.
new remote repo = the new repo to be used instead of the fork.
It seems like one should disconnect the old remote origin and set the upstream before pushing. Maybe the push with the --set-upstream overwrites that?
Here's what I'm did:
git clone ACCOUNT#vs-ssh.visualstudio.com:v3/ACCOUNT/PROJECT/FORK-NAME NEW-NAME
git remote rm origin
Create the new repository on VSTS for NEW-NAME
git push --set-upstream ACCOUNT#vs-ssh.visualstudio.com:v3/ACCOUNT/PROJECT/NEW-NAME develop
This worked for me to change from a fork to a repo. I can see the full history and open changesets from the web viewer. I did this in Azure DevOps (formerly Visual Studio Team Services AKA VSTS). I did not test against GitHub.
Pull requests and pushes are lost. Commits are still linked
I'm not sure if you need to do the push multiple times for different branches. My fork only has a develop branch anyway. I only create a master branch so git flow doesn't complain.

Merge GitHub branch into local branch

I have the following situation: I have an application checked out from GitHub, made some changes and checked it in a local repository (Bitbucket). During months I added new functionality into this local repo.
In the meantime, the GitHub project has been further developed.
Now I'm looking for a way to merge the GitHub master branch into my local master branch. It would be nice if I can do it in eclipse. How should I proceed and how can I avoid conflicts?
In the Git Repositories view:
Add an additional remote/upstream repository: right-click the node Remotes and choose Remote Remote...
Fetch from the GitHub repository: see EGit User Guide - Fetching from other Repositories
Merge changes from a remote branch of the GitHub repository into a local branch
Consider also to contribute back your changes to the GitHub project.

Import contribution to github from bitbucket

I just got a new job recently, and all repos of their projects are on BitBucket.
I used to use a lot GitHub, so I was wondering if there is a way to sync contribution between the two.
I have already tried https://github.com/jrm2k6/contwidgetor. It seems like a way to do it but didn't work for me somehow, and there is only limited support of it.
You can use Contributions Importer for GitHub
It copies all commits from source git repositories to a mock git repository. Each copied commit will report the same commit date, but the original code is not copied, neither the commit message.
The mock code is generated using the same language of the original source repository.
For example, I have a mock repository on my profile that reports all the activities of all my private repositories.
You can at least manually mirror any Git BitBucket repo from BitBucket to GitHub:
git clone --mirror http://user#bitbucket/user/repo.git
git remote add github http://user#github.com/user/repo.git
git push --mirror github
(Create an empty repo on GitHub side first)
Then, on demand, you can go into your local clone, do a fetch, and then a git push --mirror github again to sync new commits.
I was in the same situations, so I just whipped a node script together. I think it's more simple (implementation wise) than the solution posted by mir88.
The program then makes a shadow repository on GitHub. Each Bitbucket repository is represented by a file, and each Bitbucket commit is reflected by the Bitbucket commit hash.
The Bitbucket hashes are added backwards in time so the match the point in time when the original commit was made on Bitbucket.
Should be easy to change to your exact needs.
Feel free to check it out: Bitbucket 2 GitHub Activity Sync.

Github to launchpad sync

I am working on a open source project which uses bazaar for versioning and launchpad for repo. The project also has github repo but launchpad repo is primary. I am behind college proxy so i can't access ssh required to connect to launchpad to merge/push changes. Is there a way, that i commit, push all changes on my github account, and they get reflected on my launchpad account too. Can I send merge requests too?
This will give you overall idea , how to do that
create your project test in github and will be owned by organization name Acc.
then just push the master branch to test
Now fork the project and clone
Push all your local branches to your GitHub fork git push -a origin
And checkout that branch using git checkout <branch_name>. And then push to origin of that branch.
Launchpad is a project-centric environment, so you will most likely have a GitHub organization that owns the ‘main’ repository and encourage all members and newcomers to fork from that.
within fork developer can able to work on that, usually when about to issue a pull request – GitHub’s version of a merge proposal, pull down changes from the upstream organization master into their master. Since this will happen relatively often it is easiest to add an additional ‘remote’ target for it:
git remote add acc `http://github.com/acc/test.git`

From github to bitbucket

Imagine situation like this:
You have a working repo in bitbucket - you were pulling revisions from another bitbucket repo in Windows 7 through TortioseHG.
Now the second project has moved to Github system and you can not pull from it anymore.
So my question is like this:
How can i somehow create new repo in bitbucket where I will pulling changes from github and from this repo i can easily pull in Tortiose HG to my working repo?
I do not want to use Github etc, so please do not advice it to me etc just help me with my question. Thank you.
The ideal solution consiste to keep local Mercurial repo, and work only with this local repo to the existing bitbucket Mercurial remote repo.
With a plugin like Hg-Git, you can at least push to and pull from a Git server repository from Mercurial, allowing you to pull from the GitHub repo to your local Mercurial repo.
From that local (Mercurial) repo, you can then work as usual with the bitbucket remote repo.
The OP adds:
It didn't work for me so i tried to transfer git repo to hg repo and from this repo pull to my working repo with changes - but it says that: abort: repository is unrelated - but I merged a lot from it. Any help here?
That makes senses, if both repos have been developed separately, you cannot push/pull 2 (mercurial) repos one into another.
This is confirmed at the bottom of the page "Understanding Mercurial", and detailed in the blog post: "What Mercurial Can't Do: Subtree Repos".
The more practical solution would be to make one extra repository (a "parent one") with your two repos declared in it as nested repository.
It would keep both repos independent, allowing to push back to the GitHub repo from your second mercurial repo.
If you don't have to push back to GitHub, but really want to have one repo in which you merge common files, then you can look in "Merge tip from an unrelated repository with Mercurial", but that is much more complex.
I would rather:
keep both repos separate
delete from the first one the common files you need to merge in the second one.
report and merge those common files in the second one.