繁体   English   中英

如何对 github 项目执行多个拉取请求

[英]How to do multiple pull requests to github project

我一直以非常简单的有限方式使用 git 和 opensrc

  • 我在github 中fork项目
  • 我的叉子克隆到我的电脑上
  • 我在我的电脑上做了一些改变
  • 提交更改
  • 送到我的 github fork
  • 我从我的github fork 创建拉取请求到原始项目

这适用于单个更改。

如果我在我的计算机上进行更多更改并在接受拉取请求之前提交它们并推送,那么它们将被添加到同一个拉取请求中。 我知道这并不理想,所以我尝试等待第一个拉取请求被接受,然后再进行进一步的更改,但这并不总是可能的。

所以我理解,理想情况下,您应该为每个错误修复创建单独的分支。 所以我创建了一个新分支,进行了更改,提交了更改并将它们推回了 github。 但是我在 github 上看不到这个新分支,我不确定接下来要做什么?

当我在这个新分支上运行git push 时,我得到

ubuntu@ip-172-31-39-147:~/code/discogs-xml2db/speedup$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

我在另一个分支上推送时没有得到这个,这是否意味着推送实际上没有发生?

更新所以我尝试了 Schwerns 的建议,命令原样不太有效,但添加setup upstream origin确实起作用了,更改被推送到 github,我现在在 github 上看到了这个新分支。

ubuntu@ip-172-31-39-147:~/code/discogs-xml2db/speedup$ git config --global push.default simple
ubuntu@ip-172-31-39-147:~/code/discogs-xml2db/speedup$ git push
fatal: The current branch releasestatus has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin releasestatus

ubuntu@ip-172-31-39-147:~/code/discogs-xml2db/speedup$ ^C
ubuntu@ip-172-31-39-147:~/code/discogs-xml2db/speedup$  git push --set-upstream origin releasestatus
Username for 'https://github.com': ijabz
Password for 'https://ijabz@github.com':
Counting objects: 17, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 600 bytes | 0 bytes/s, done.
Total 6 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
remote:
remote: Create a pull request for 'releasestatus' on GitHub by visiting:
remote:      https://github.com/ijabz/discogs-xml2db/pull/new/releasestatus
remote:
To https://github.com/ijabz/discogs-xml2db.git
 * [new branch]      releasestatus -> releasestatus
Branch releasestatus set up to track remote branch releasestatus from origin.

我认为您从未将更改推送到 Github。 Git 告诉你它没有完全配置,你需要修复它。

git push实际上还有两个部分:推送到哪里(“远程”),以及推送到哪个分支。 当你在你的主分支上git push真的是git push origin master 您从中克隆的远程存储库称为“origin”,Git 知道您的 master 分支来自它的 master 分支。

当你创建一个新分支时,Git 不知道你想把它推到哪里。 如果您在新分支上运行git push ,它将不得不猜测。 push.default告诉 Git 如何猜测,它没有设置。

您可以阅读git-config以了解有关选项的更多信息,但我建议将其设置为simple 它会猜测您想将其推送到与您自己的名称相同的分支。

git config --global push.default simple

现在你应该可以git push到 Github。

您也可以为 Git 拼写: git push origin <name of your branch>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM