【发布时间】:2013-07-08 20:29:09
【问题描述】:
我正在尝试将一个提交推送到原始主机。但是我收到一条错误消息,说我首先需要获取然后合并,但是在拉取后我收到了这个错误。任何想法将不胜感激。
Richard@RICHARD-PC /e/Work/MH (master)
$ git pull
remote: Counting objects: 27, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 14 (delta 8), reused 0 (delta 0)
Unpacking objects: 100% (14/14), done.
From file:///V:\
930430f..3a55dca master -> origin/master
Auto-merging project/src/main/java/com/company/project/outgoing/HttpsCallService.java
Merge made by the 'recursive' strategy.
.../java/com/company/project/auth/BcagHmacGenerator.java | 2 +-
.../com/company/project/outgoing/HttpsCallService.java | 16 ++--------------
deployLocal.sh | 2 +-
3 files changed, 4 insertions(+), 16 deletions(-)
Richard@RICHARD-PC /e/Work/MH (master)
$ git push origin 72ba712:master
To file:///V:\
! [rejected] 72ba712 -> master (non-fast-forward)
error: failed to push some refs to 'file:///V:\'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
这里是提交列表,不是 72ba712 的位置:
Richard@RICHARD-PC /e/Work/MH (master)
$ git lol
* eec2ab2 (HEAD, master) Merge branch 'master' of file:///V:\
|\
| * 3a55dca (origin/master) <comments>
* | 72ba712 <comments>
* | bc55eb5 <comments>
* | c2aa448 Merge branch 'master' of file:///V:\
|\ \
| |/
| * 930430f <comments>
* | fc7a55b <comments>
* | fd401a5 <comments>
【问题讨论】:
-
您确定没有人在您的
git pull和git push之间推送新的提交吗?如果存储库中有很多活动,这确实会发生。 -
是的,只有我们两个人,起源在其他人的电脑上。他坐在我旁边,自从拉动后没有任何变化。
-
您不只是推送单个提交,尤其是当它们不在分支的顶端时。您推送一个或多个包含您要推送的提交的分支。
-
感谢 twalberg,但这是一种特殊情况,我只想将一个提交更改推送到原点,而不是所有其他的。
-
我的意思是,
git不是这样工作的,从这个意义上说,你希望它以这种方式工作并不重要......它不......