Git工作分支与更新

4
我想知道在Git中是否能实现以下情况。 我复制了别人的存储库。 我想要在自己的存储库上工作,并从初始存储库获取更新。 偶尔,我想要发布我的代码并向初始存储库发送拉取请求。 我不确定这是否可行,如果可以,请简要描述应该怎么做。
2个回答

阿里云服务器只需要99元/年,新老用户同享,点击查看详情
2
这是可能的,但最佳实践包括:
  • doing your modification in your own branch (that you can push to your fork)
  • updating the branches common with the original repo with a git fetch upstream (upstream being the name of a remote referencing the original repo you forked)
  • rebasing your own branch on top of the updated original branch:
    (See "git fork is git clone?")

    git checkout myBranch
    git rebase upstream/master
    
  • if you do a PR, try to make it a small one (with a few commits in it), focus on a specific feature, rather than doing a large one, with many commits and many changes in it.

在 "拉取请求的夫妻提示 " 中查看更多。

1
您可以按照以下步骤操作:
  1. 在本地机器上处理克隆的分叉库。通常你会从克隆的库中克隆,以便可以将其推送到它
  2. 将更改推送到此存储库(origin 将是分叉的存储库,而您的本地分支将由 master 跟踪)- git push origin master
  3. 从您分叉的存储库向原始存储库提交拉取请求 - 参考 this link
您可以阅读 github文档 以获取更多详细信息。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,