我已经通过关注this tutorial将SVN存储库转换为Git。现在似乎无法提取像this answer中建议的子存储库。Git不会恢复或提交它认为被修改的文件
原谅长文章,但大部分文本是格式良好的git输出。
操作系统:Windows 8 命令行:MinGW的 Git版本:1.8.1.msysgit.1
中提取subrepository似乎并没有工作,除非你有一个干净的临时区域和没有修改的过程文件。
git status
告诉我,我有一个修改过的文件,即使这是一个新鲜的SVN导入。好的,让我们试着摆脱它。
尝试并恢复文件。
user$ git status
# On branch master
# 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: folder with space/folder/toolbar.png
#
no changes added to commit (use "git add" and/or "git commit -a")
user$ git checkout -- "folder with space/folder/toolbar.png"
user$ git status
# On branch master
# 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: folder with space/folder/toolbar.png
#
no changes added to commit (use "git add" and/or "git commit -a")
这并没有奏效,但我并不在乎是否提交,所以我会尝试下一步。
user$ git commit -a -m "Testing if committing fixes it"
# On branch master
# 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: folder with space/folder/toolbar.png
#
no changes added to commit (use "git add" and/or "git commit -a")
user$ git status
# On branch master
# 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: folder with space/folder/toolbar.png
#
no changes added to commit (use "git add" and/or "git commit -a")
通过跳过暂存提交不起作用,所以让我们先尝试着手。
user$ git add "folder with space/folder/toolbar.png"
user$ git status
# On branch master
# 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: folder with space/folder/toolbar.png
#
no changes added to commit (use "git add" and/or "git commit -a")
无法正常工作,所以我很难过...去问一个更聪明的人。
我是git的新手,但很熟悉汞,并且已经阅读this online tutorial以启动自己。
我完全有可能搞砸了一个简单的命令。
已经尝试过: 我环顾四周,解决我的具体问题,但有一点运气。我偶然发现了this answer这似乎相关,但不能解决我的问题。
编辑:可能有趣的事 这是让我困惑的部分。前段时间我推出了这个回购协议进入在线资源库。新鲜的克隆后,回购仍然认为文件被修改(即git status
返回相同的结果,我已经设置git config --global core.autocrlf false
并验证通过运行git config --global core.autocrlf
确实返回false)。
编辑2:解决发现的,但问题仍然没有完全理解 我已经成功通过简单地从系统中,临时区域删除文件,然后提交更改修复库。 之后,我将文件复制回来并将其提交到存储库。
问题虽然固定,但只会让我更困惑。
当我玩弄移除文件时,我注意到如果我重置版本库到最后一次提交已删除文件的HEAD,git status将表示没有任何更改,并且该文件未被跟踪,但是文件将被恢复在我的工作树。这是奇怪的,因为它被标记为在git中被删除...
只有在第二次删除它后,即使git不再记住它,我是否设法实际删除它,以便git reset
和git reset --hard
不会恢复该文件。
如果有人能请解释我是如何陷入这种状态下,如果是在Git中或正常行为的错误我将不胜感激。
我suspitions 我已经失去了我使用,但发生了什么事去像这样的命令序列: 该文件是Images/toolbar.png
,我已经航行到Images
文件夹。
之后我删除它从文件系统Git的检测,像这样的变化:
# On branch master
# 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)
#
# deleted: toolbar.png
# deleted: ../images/toolbar.png
#
注意一个事实,即images
文件夹不大写!这是在Windows中运行,忽略路径情况。我怀疑这可能是问题的一部分...
我真的很困惑,但我的问题了。所以这篇文章只是作为一种好奇心,尽管我无法复制它在某处从SVN转换中的行为。
看起来好像git可能没有正确处理你的文件。是否有可能尝试删除文件夹名称中的空格,并查看是否可以修复它? – Devin 2013-04-11 04:24:05
可能是的,简单不...我会尝试。 – nonsensickle 2013-04-11 04:27:46
现在,我试图拉一个干净的存储库,但我怀疑这不会帮助。在尝试完成后,我会尝试删除空间,但版本库不小。另外,为什么git会遇到路径中的空间问题? – nonsensickle 2013-04-11 04:42:47