简体   繁体   English

我的分支领先于大师……但我无法推动大师

[英]My branch is ahead of master…but I can't push to master

This may be a Git 101 type question, but....I've forked a repo and am pushing my commits to it, then submitting pull requests (all this is on GitHub) to the origin repo. 这可能是一个Git 101类型的问题,但是....我已经分叉了一个存储库,并向其推送我的提交,然后将拉取请求(所有这些都在GitHub上)提交到原始存储库。 Periodically I'll pull from the origin to bring in the latest source from others. 我会定期从源头引进其他人的最新消息。

That's been my workflow. 那是我的工作流程。 Currently though, when I run a git status I'm told that my master branch is X commits ahead of origin/master and that I should push to publish my changes. 不过目前,当我运行git status我被告知我的master分支是X,它比origin / master更早提交,并且我应该推动发布更改。 I don't have those rights however. 我没有这些权利。

I never push anything to my fork's master repo, I only do branches, push to them, then open a PR and eventually merge origin/master back to my master. 我从不将任何东西推送到我的fork的主仓库中,我只做分支,推送到它们,然后打开PR,最后将原点/ master合并回我的master。 I'll then branch from master to start the cycle again. 然后,我将从master分支重新开始循环。

I've pushed my changes to my fork, and have a PR outstanding, so would that explain the message? 我已将自己的变更推送到我的叉子上,并拥有出色的PR,所以可以解释这个信息吗? Otherwise, since I can't push to origin will I have to just live with this message from here on out? 否则,由于我无法推销原产地,我是否必须从现在开始一直忍受此消息?

You need to make sure that every time you checkout a new feature branch you do a fetch origin then checkout origin/master then base your branch off that: git checkout -b my-new-feature . 您需要确保每次签出一个新功能分支时,都fetch origin然后checkout origin/master然后以该分支为基础: git checkout -b my-new-feature If you didn't do this, you can do a git rebase origin/master 如果您不这样做,则可以执行git rebase origin/master

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

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