即使已拉远遥控器,Git push仍抱怨抱怨不快进 [英] Git push complaining about non-fast-forward, even though remote has been pulled

查看:67
本文介绍了即使已拉远遥控器,Git push仍抱怨抱怨不快进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将更改推送到NAS上的存储库中.我以某种我不理解的方式失败了.

I'm trying to push my changes to a repo on my NAS. It's failing in a way I don't understand.

文档指出:默认情况下,push仅适用于快进更新.很公平.所以我做了一个git pull(我的遥控器叫做rubix):

The documentation states that by default push works only with fast-forward updates. Fair enough. So I do a git pull (my remote is called rubix):


D:\RoboCup\Dev\TinMan>git pull rubix master
From ssh://rubix/volume1/git/TinMan
 * branch            master     -> FETCH_HEAD
Already up-to-date.

一切看起来不错.让我们尝试推动...

All looks well. Let's try pushing...


D:\RoboCup\Dev\TinMan>git push rubix master
To ssh://dnoakes@rubix/volume1/git/TinMan
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://dnoakes@rubix/volume1/git/TinMan'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about
fast-forwards' section of 'git push --help' for details.

我已经阅读了git push上的文档,但是到现在为止我还不明白为什么会遇到这个问题.

I've read through the documentation on git push but at this point I can't understand why I'm seeing this problem.

以下是一些其他上下文信息:

Here is some other contextual info:


D:\RoboCup\Dev\TinMan>git --version
git version 1.7.0.2.msysgit.0

D:\RoboCup\Dev\TinMan>git branch
* (no branch)
  master

最后一行看起来很可疑.我怎么不能在任何分支机构?还要注意,我也有一些未跟踪的文件和修改的(未暂存的)更改.

That last line looks suspect. How can I not be on any branch? Note too that I have some untracked files and modifieds (unstaged) changes too.

任何帮助将不胜感激.谢谢.

Any help would be greatly appreciated. Thanks.

推荐答案

这是一种获得同步的方法.

Here's one way to get synced up.

首先,提交所有更改,然后使用git log记录要推送的所有提交.

First, Commit any changes, then use git log to note any commits you wanted to push.

下一步,重置主机,使其与遥控器匹配,如下所示:

Next reset your master to match the remote like this:

git checkout master
git reset --hard remotes/rubix/master 

最后,樱桃选择您想要保留的提交

Finally, cherry pick the commits you wanted to keep

示例:

git cherry-pick 111aaa111
git cherry-pick 123abc123

现在推应该可以了.

git push rubix master

这篇关于即使已拉远遥控器,Git push仍抱怨抱怨不快进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆