Git fork 和 pull 请求工作流程

标签 git bitbucket git-fork git-tower

我有一个 React 项目的仓库。我想将该 repo 作为其他一些项目的“基础”,并将其用作起点。我还想根据“基础”的进展情况,使所有其他源自它的 repo 协议(protocol)保持最新。

我正在使用 Bitbucket 进行远程存储库托管,并在本地使用 Tower 作为一个不错的 GUI。

执行此操作的正确方法是在 Bitbucket 中 fork “基础”,然后在本地克隆它吗?本地 repo 是否会以任何方式了解“基本” repo 的更新?我怎么知道是否对“基本”存储库做出了重大 promise ,这将使任何 fork 的存储库受益?

或者,如果我对 fork 的存储库进行更改以使所有其他存储库受益,我是否可以执行 pull 请求以便“基础”存储库知道它应该 pull 更新?

请原谅我的无知,我目前根本没有使用 fork 或 pull 请求,我正在努力解决它:)

最佳答案

Will the local repo be aware of updates to the "base" repo in any way?

否:您需要添加一个远程,(通常)命名为上游,引用原始仓库

cd /path/to/local/clone/of/fork
git remote add upstream /url/original/repo

git checkout master

# detailed step:
git fetch upstream
git merge upstream/master

# or (shorter)
git pull upstream master

Alternately, if I make a change to the forked repo that would benefit all of the other repos, can I do a pull-request so the "base" repo knows that it should pull in the updates?

是的,这将是一个典型的 pull 请求。

关于Git fork 和 pull 请求工作流程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51562124/

相关文章:

git - 为什么 git detached HEAD 甚至存在?

git - 索引有reflog吗?

git - 如何从 jenkins 登录到 git bitbucket 存储库

github - npm 安装并构建 fork 的 github 存储库

亚搏体育实验室: how to fork a private repository from server A to a server B?

github-api - 如何获取 Linux 上 GitHub 存储库的所有分支的列表?

git - 全局 git 配置数据存储在哪里?

bash - git 的最终别名失败(__git_aliases 命令似乎已被弃用)

macos - Git pull 卡在 SMB 共享存储库上

Mercurial 存储库与 bitbucket 子存储库 - 如何防止推送