我正在做一个基于CakePHP的项目,该项目托管在GitHub上。我的项目托管在Bitbucket上。它们都使用git。基本上,我想在我的Bitbucket存储库中创建一个CakePHP的“分支”(我不知道我是否使用了正确的术语,因为我是git新手),以便能够获得更新,而不需要下载所有的CakePHP压缩包并替换文件夹,然后提交和推送,但可能需要一个“合并”(?)。
发布于 2011-12-11 20:18:33
现在不可能跨不同的站点发送“拉取请求”。我已经在Bitbucket问题跟踪器中添加了一个特性请求:#3288。如果你想跟踪这篇文章,我建议你将自己添加为追随者。
但是,您仍然可以将源代码从GitHub移动到Bitbucket,而不必下载任何压缩文件或tarball。你从GitHub创建一个克隆并推送到Bitbucket:
$ git clone https://github.com/cakephp/cakephp
$ cd cakephp
$ git push git@bitbucket.org:mg/cakephp.git master
我首先在Bitbucket中将mg/cakephp
创建为一个空的Git存储库。这样,您就可以将变更集从GitHub推送到Bitbucket。
发布于 2013-02-27 14:46:59
下面的工作流程将github存储库添加为一个名为sync
的新远程,并将bitbucket远程添加为origin
。它还添加了一个名为github
的分支来跟踪github存储库,以及一个名为master
的分支来跟踪bitbucket存储库。它假设您有一个名为“repository”的bitbucket存储库,该存储库为空。
安装程序远程
# setup local repo
mkdir myrepository
cd myrepository
git init
# add bitbucket remote as "origin"
git remote add origin ssh://git@bitbucket.org/aleemb/myrepository.git
# add github remote as "sync"
git remote add sync https://github.com/aleemb/laravel.git
# verify remotes
git remote -v
# should show fetch/push for "origin" and "sync" remotes
设置分支
# first pull from github using the "sync" remote
git pull sync
# setup local "github" branch to track "sync" remote's "master" branch
git branch --track github sync/master
# switch to the new branch
git checkout github
# create new master branched out of github branch
git checkout -b master
# push local "master" branch to "origin" remote (bitbucket)
git push -u origin master
现在,您应该让本地github
分支跟踪github存储库的master
分支。您应该让本地master
分支跟踪bitbucket存储库(默认情况下是master
分支)。
这使得很容易在github
分支上执行拉操作,然后将这些更改合并到master
分支上(rebase优先于merge ),然后您可以推送master
分支(会将其推送到bitbucket)。
发布于 2013-01-25 13:52:09
如果您想让您的存储库保持最新,请使用两个远程: Github (upstream
)和Bitbucket (origin
),如下所示:
# Clone original CakePHP source code from Github
git clone --mirror https://github.com/cakephp/cakephp
cd cakephp
# Rename remote from `origin` to `upstream`
git remote rename origin upstream
# Add your Bitbucket repo (this is where your code will be pushed)
git remote add origin https://bitbucket/your/repo.git
# Push everything to Bitbucket
git push --mirror origin
要从Github拉取CakePHP更新:
git pull upstream master
要将代码更改推送到Bitbucket:
git push origin master
https://stackoverflow.com/questions/8137997
复制相似问题