【发布时间】:2013-08-28 06:33:35
【问题描述】:
我遇到了一个非常奇怪的 git 问题。我有一个 ruby 应用程序在运行在 runit 管理下的服务器上。此应用程序具有自动更新功能。
它执行git ls-remote 来检查是否需要拉取和服务重启。这部分工作正常,执行内容并拉取文件,但是:拉取之后,所有拉取的更改都保留在 "changes not staged for commit" 中。执行git reset --hard 后,repo 没有为提交准备任何更改,但 repo 的本地副本显示它比 origin/branch 提前 X 次提交。
我不确定为什么会发生这种情况以及如何解决问题。有没有人经历过类似的事情?任何指针表示赞赏。
为了简单起见,软件在 Ubuntu 12.04、ruby 1.9.3p448 上运行(以 root 身份运行的 runit)。文件具有正确的权限,至少看起来是这样。
代码可以看这里:https://github.com/radekg/rgossip_app/blob/dev/lib/updater.rb
git pull、git fetch 和 git reset 都不起作用。
*更新:*
git status 返回:
root@ip-10-222-29-69:/opt/rgossip# git status
# On branch dev
# Your branch is ahead of 'origin/dev' by 1 commit.
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README.md
#
no changes added to commit (use "git add" and/or "git commit -a")
git diff:
root@ip-10-222-29-69:/opt/rgossip# git diff
diff --git a/README.md b/README.md
index e7136db..e9d7360 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,3 @@
Managing Chef boxes with gossip.
-More description soon. Testing.
\ No newline at end of file
+More description soon.
\ No newline at end of file
这就是这次提交:https://github.com/radekg/rgossip_app/commit/176e7cf764ff9ea0299ef75a21bb79a5bea11406
执行git reset --hard后我得到:
root@ip-10-222-29-69:/opt/rgossip# git reset --hard
HEAD is now at 176e7cf Testing with commits seems stupid.
【问题讨论】:
-
git status准确地说出什么?git diff说明了什么? -
我已经用这些信息更新了我的问题。
-
我围绕这个做了一些测试。只有当我将
--git-dir与拉动一起使用时,问题似乎才会发生。我将尝试复制此问题并发布我的发现。
标签: ruby git ubuntu-12.04 runit