从Git中的fork父级拉取更改

从Git中的fork父级拉取更改

问题描述:

如何从Git中的fork的父级中拉出更改,特别是在github配置的项目中?

How do you pull changes from the parent of a fork in Git, specifically in a github configured project?

例如,说我将 http://github.com/originaluser/originalproject 分叉到 http://github.com/myuser/myproject .我不打算将myproject用作永久分支,因为我只想维护一个"dev"分支来测试一些实验性功能,然后最终将其合并回原始项目中.

For example, say I forked http://github.com/originaluser/originalproject into http://github.com/myuser/myproject. I don't plan on myproject on being a permanent fork, as I only want to maintain a "dev" branch to test some experimental features, and then eventually merge it back into the original project.

这样,无论何时对originalproject进行提交,我都希望能够将它们拉下来并与myproject合并.但是,我也希望能够将更改推送到myproject中,但还​​没有立即创建一个pull请求,以将它们合并到originalproject中,直到我的分支完成并经过测试为止.最好的方法是什么?

As such, whenever commits are made to originalproject, I want to be able to pull them down and merge them with myproject. However, I also want to be able to push changes up into myproject, but not yet immediately create a pull request to get them merged into originalproject until my branch is complete and tested. What's the best way to do this?

默认情况下,当我为本地开发创建github分支的本地结帐/分支,然后进行推/拉更改时,这些更改只会影响我的个人分支.我从来没有从原始项目中得到任何改变.我该如何解决?

By default, when I create a local checkout/fork of my github fork for local development, and then push/pull changes up, these changes only effect my personal fork. I never get changes from the original project. How do I fix that?

对于任何不正确的git术语表示抱歉.

Sorry for any incorrect git terminology.

在其他答案上,这些是我对tsc-watch进行的前叉操作的步骤:

Expanding on other answers, these are the steps I took on a fork I had of tsc-watch:

git remote add upstream https://github.com/gilamran/tsc-watch.git
git fetch upstream
git merge upstream/master
git push

解释:

  1. 将远程服务器添加为上游
  2. 从上游获取所有更改
  3. 将更改从上游分支合并到我的master分支
  4. 将所有更改推送到github