如何在 BitBucket 上 fork 自己的 repo?

Y.N*_*Y.N 8 fork bitbucket

如何在 BitBucket 上分叉你自己的 repo?

我知道如何从 Web 界面分叉另一个用户存储库,并且我知道如何克隆我的存储库。

但是如何在 BitBucket 上 fork 自己的 repo 并简化未来的 pull request 工作流程?

Gab*_*oli 6

转到您的存储库,然后转到操作 -> 分叉。

如果您启用了新导航,请转到您的存储库,单击左侧导航栏上的 +,然后开始工作 -> 分叉此存储库。

另外,请确保在存储库设置中启用了分叉(对于现有存储库)。


小智 5

首先,创建一个新的存储库“bar”。接下来,克隆现有项目“foo”:

$ git clone git@bitbucket.org:YOURNAME/foo.git bar
Run Code Online (Sandbox Code Playgroud)

接下来,编辑 Git 配置文件并将原始 URL 替换为新 URL:

$ cd bar
$ vim .git/config
    [remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = git@bitbucket.org:YOURNAME/bar.git #replace foo with bar
Run Code Online (Sandbox Code Playgroud)

可以选择将原始存储库添加为上游源:

$ git remote add upstream git@bitbucket.org:YOURNAME/foo.git
Run Code Online (Sandbox Code Playgroud)

最后,将新存储库推送到 Bitbucket:

$ git push -u origin master
Run Code Online (Sandbox Code Playgroud)

现在您可以按预期从新存储库(栏)中推送/拉取。您还应该能够使用以下命令合并上游更改:

$ git fetch upstream
$ git merge upstream/master
Run Code Online (Sandbox Code Playgroud)

信用:比特漂移