在我的主分支中,我做了一个git merge some-other-branch本地,但从未将更改推送到原始主.我不是故意合并,所以我想撤消它.在git status合并后执行操作时,我收到此消息:
# On branch master
# Your branch is ahead of 'origin/master' by 4 commits.
Run Code Online (Sandbox Code Playgroud)
git revert HEAD -m 1
Run Code Online (Sandbox Code Playgroud)
但现在我收到这条消息git status:
# On branch master
# Your branch is ahead of 'origin/master' by 5 commits.
Run Code Online (Sandbox Code Playgroud)
我不希望我的分支通过任何数量的提交领先.我该如何回到那一点?
我试图遵循一些步骤来贡献GitHub上的存储库,其中一个步骤不起作用.步骤如下:https://github.com/wdbm/qTox/blob/master/CONTRIBUTING.md#how-to-open-a-pull-request.
我在GitHub上分叉存储库.
我克隆了存储库:
git clone https://github.com/<YOUR_USER>/qTox.git
Run Code Online (Sandbox Code Playgroud)
我访问本地存储库的目录:
cd qTox
Run Code Online (Sandbox Code Playgroud)
我添加了上游远程,以便能够从上游存储库中获取:
git remote add upstream https://github.com/qTox/qTox.git
Run Code Online (Sandbox Code Playgroud)
我尝试将本地主分支指向上游存储库:
git branch master --set-upstream-to=upstream/master
Run Code Online (Sandbox Code Playgroud)
此命令失败,并显示以下错误消息:
error: the requested upstream branch 'upstream/master' does not exist
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that …Run Code Online (Sandbox Code Playgroud)