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

时间:2020-03-08 18:55:21

标签: git github

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

  • fork github
  • 中的项目
  • git clone 我的叉子到计算机上
  • 我在计算机上进行了一些更改
  • 提交更改
  • 到我的github分支
  • 我从 github 分支创建 pull请求到原始项目

这适用于单个更改。

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

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

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

public class MyService extends Service {
private final ScheduledExecutorService scheduler =
        Executors.newScheduledThreadPool(1);   

@Override
public int onStartCommand(Intent intent, int flags, final int startId) {

    final Runnable runnable = new Runnable() {
        @Override
        public void run() {
            //do something regulary
            scheduler.schedule(this,getNewInterval(),MILLISECONDS);
        }
    };

  //create notification, notification channel, startForegorund()


    scheduler.schedule(runnable,1,MINUTES);
    return START_STICKY;
}

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

更新 因此我尝试了Schwerns的建议,该命令原本效果不佳,但是添加设置上游原点确实起作用,更改已推送到github,现在我在github上看到了这个新分支。

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)

1 个答案:

答案 0 :(得分:1)

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

git push实际上还有两个部分:推送到的位置(“远程”)和推送到的分支。当您在主分支上时,git push实际上是git push origin master。您从中克隆的远程存储库称为“源”,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>

相关问题