Git 向上游推送
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12910159/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git push upstream
提问by dmb
I've tried looking for an answer for this but can't find a straight answer.
我试过为此寻找答案,但找不到直接的答案。
I'm running the code below.
我正在运行下面的代码。
git fetch upstream # get the latest copy from master / upstream
git merge upstream/master # merge the downloaded copies and merge to your copy
git commit -am"test" # commit your latest changes
git push origin master # push to your fork
git push upstream # push to master copy from where you forked your project - is this safe?
is it safe to push to upstream (git push upstream
)? My main goal is to apply my changes from my fork to the main project. Or there's a better way? thanks
推到上游 ( git push upstream
) 是否安全?我的主要目标是将我的 fork 更改应用到主项目。或者有更好的方法吗?谢谢
回答by Olaf Dietsche
It depends on wether you have the privileges to push. If you haven't, ask the owner of the upstream repository to pull from your fork.
这取决于您是否有权推送。如果您还没有,请要求上游存储库的所有者从您的分支中提取。
回答by Dan Dascalescu
Since you've tagged this question as GitHub, I assume you want to push your changes to your fork, then issue a pull request from GitHub's UI. Git doesn't have a command line option to issue pull requests.
由于您已将此问题标记为 GitHub,因此我假设您想将更改推送到您的 fork,然后从 GitHub 的 UI 发出拉取请求。Git 没有用于发出拉取请求的命令行选项。
You can read more at https://help.github.com/articles/using-pull-requests
您可以在https://help.github.com/articles/using-pull-requests阅读更多信息