I'm working on a project based on CakePHP, that's hosted on GitHub. My project is being hosted on Bitbucket. Both of them use git. Basically I'd like to create a ‘fork’ (I don't know if I'm using the right terms, since I'm new to git) of CakePHP in my Bitbucket repository, in order to be able to get the updates without the need to download all the CakePHP zip/tar and replace the folder, then commit and push, but maybe with a ‘merge’(?).
Thank you!
I'm guessing you just want to easily download the repository with your project... and that you will NOT be contributing the cakePHP, correct?
if so, you just need to add a external reference to your repo.
SVN:externals equivalent in GIT?
And later, even if you want to contribute to cakePHP, you can just do so at the original repo just fine.
It's not possible to send "pull request" across different sites today. I've added a feature request for this in the Bitbucket issue tracker: #3288. I suggest you add yourself as a follower if you want to track this.
However, you can still move the source from GitHub to Bitbucket without having to download any zip files or tarballs. You make a clone from GitHub and push to Bitbucket:
I created
mg/cakephp
as an empty Git repository in Bitbucket first. That way you can push/pull changesets from GitHub to Bitbucket.When creating a new repository in BitBucket, click the button
Import repository
at the top right. Enter the https url found when clickingClone or download
in Github for the repository you want to fork.Give your repository a name, configure your privacy settings, and there you go!
The workflow below adds the github repository as a a new remote called
sync
and the bitbucket remote asorigin
. It also adds a branch calledgithub
to track the github repository and a branch calledmaster
to track the bitbucket repository. It assumes you have a bitbucket repository called "myrepository" which is empty.Setup remotes
Setup branches
Now you should have the local
github
branch tracking the github repo'smaster
branch. And you should have the localmaster
branch tracking the bitbucket repo (master
branch by default).This makes it easy to do a pull on the
github
branch, then merge those changes onto themaster
branch (rebase preferred over merge though) and then you can push themaster
branch (will push it to bitbucket).If you want to keep your repo up to date, use two remotes: Github (
upstream
) and Bitbucket (origin
) like this:To pull updates to CakePHP from Github:
To push your code changes to Bitbucket: