问题描述
|
今天,我键入了没有想到的文件名
git commit
,奇怪的事情发生了。
通常它只会告诉我“使用文件名或-a,傻瓜”,但这一次它显示:
$ git commit -m \"some change\"
[master 1d75411] some change
37 files changed,1566 insertions(+),1189 deletions(-)
create mode 100644 fileA
create mode 100644 fileb
[...]
delete mode 100644 fileC
delete mode 100644 fileD
[...]
这些更改已经出现在服务器上!就像我做了push
或merge
一样!!!
尽管我一直尝试提交该文件,但一切都与以前完全相同。
没有文件被删除,没有文件被更改。 Unix权限与以前相同!
发生了什么?!
编辑:
现在,每隔两次提交,就会发生这种情况:
$ git status
* nothing changed *
$ git diff
* nothing *
$ edit somefile
$ git commit -m \"some change\" somefile
[master f875c5b] some change
21 files changed,4 insertions(+),1563 deletions(-)
delete mode 100644 fileA
delete mode 100644 fileB
delete mode 100644 fileC
[...] (somefile does not even appear on the console output,only if i get log later)
$ git status
# On branch master
# Changes to be committed:
# (use \"git reset HEAD <file>...\" to unstage)
#
# new file: fileA
# new file: fileB
# new file: fileC
[...]
$ git commit -m \"re-add files? why?\"
$ git push
$ git status
* nothing changed *
$ git diff
* nothing *
$ edit somefile
$ git commit -m \"some change\" somefile
[master f875c5b] some change
21 files changed,1563 deletions(-)
delete mode 100644 fileA
delete mode 100644 fileB
delete mode 100644 fileC
[...]
$ git status
# On branch master
# Changes to be committed:
# (use \"git reset HEAD <file>...\" to unstage)
#
# new file: fileA
# new file: fileB
# new file: fileC
[...]
而已。我只是认为我对git不够聪明,并将这个项目托管在Subversion中。无论如何,在此阶段不需要太多历史记录,因此现在可以将其丢失。
在我有时间完全阅读git书之后,我可以再说一遍。
感谢您尝试提供帮助,但这太怪异和无用。
另外,出于对某人的好奇,到目前为止,我的工作流程一直是这样(两个月来这样做,直到今天一切都很好)
$ git fetch
$ git merge origin/master master
$ edit file
$ git add somenewfile
$ git commit -m \'something changed\' file somenewfile
$ git push
解决方法
由于没有人能解释这一点,因此我假设这是一个错误,我将关闭。
就留在这里,即使将来有人搜索它。
我已经将日志发送给开发人员,从未回过头,但是由于我正在使用的版本之后有一些修订,因此我只是假设它是固定的...但是我永远不会知道,因为不使用git on这个项目了。
, 在commit命令中指定文件时,看起来就像是正常行为:
http://git-scm.com/docs/git-commit:
文件>…
当在命令行上提供文件时,该命令将提交命名文件的内容,而不记录已进行的更改。这些文件的内容也会在之前已执行的内容的基础上,为下一次提交而进行。