为什么 Git 树中的文件夹名称有错误的字符?
Why folder name in Git tree has wrong character?
当我注意到工作目录中有一个文件时,我试图进行提交,我没有更改它并且文件夹名称中的第一个字母错误:
Changes to be committed:
new file: "\txample/src/Example.Repository/Services/Authentication/IAuthenticationService.cs"
Changes not staged for commit:
deleted: "\txample/src/Example.Repository/Services/Authentication/IAuthenticationService.cs"
modified: Example/src/Example.Repository/Database/EquityOrder.cs <-- correct folder name
我的“IAuthenticationService.cs”文件从未更改过,但仍然出现在'git status'中并且文件夹名称错误,应该是“Example”而不是“\txample”。
我试图使用 'git checkout HEAD -- filename' 放弃对此文件的更改。
当我将错误的文件夹名称 (\txample) 与 'git checkout' 一起使用时,它没有找到该文件,但使用正确的文件夹名称(示例)却没有错误。但是,这个文件并没有从 'git status'
中消失
我尝试使用 'git ls-tree' 列出树中的所有文件,发现那里存在一个文件夹名称不正确的路径。
虽然 'git status' 显示仅对一个文件进行了更改,但使用此错误路径创建提交会删除大量文件并以我无法理解的模式创建大量文件。
create mode 100644 Example/src/Example.Repository/ReflectionHelpers.cs
.....
create mode 100644 Example/src/Example.Repository/ReflectionHelpers.cs
.....
create mode 100644 Example/src/Example.Repository/ReflectionHelpers.cs
.....
delete mode 100644 Example/src/Example.Repository/ReflectionHelpers.cs
... (same for other files)
我真的不明白为什么会发生这种情况以及如何解决这个问题。预先感谢您的帮助
OS 是 Windows 10,使用 Git Bash
使用与我在“Remove a file with a strange name from git”中提到的类似的技术,尝试使用 git bash:
git mv $(printf "\txample") "Example"
# or
git rm --cached -- $(printf "\txample/")
看看重命名或删除“错误”文件夹是否至少可以使任何文件再次可访问。
OP 指的是“Unstaged changes left after git reset --hard”
git rm --cached -r .
git reset --hard
再次小心使用(这会删除任何正在进行的工作)
当我注意到工作目录中有一个文件时,我试图进行提交,我没有更改它并且文件夹名称中的第一个字母错误:
Changes to be committed:
new file: "\txample/src/Example.Repository/Services/Authentication/IAuthenticationService.cs"
Changes not staged for commit:
deleted: "\txample/src/Example.Repository/Services/Authentication/IAuthenticationService.cs"
modified: Example/src/Example.Repository/Database/EquityOrder.cs <-- correct folder name
我的“IAuthenticationService.cs”文件从未更改过,但仍然出现在'git status'中并且文件夹名称错误,应该是“Example”而不是“\txample”。
我试图使用 'git checkout HEAD -- filename' 放弃对此文件的更改。 当我将错误的文件夹名称 (\txample) 与 'git checkout' 一起使用时,它没有找到该文件,但使用正确的文件夹名称(示例)却没有错误。但是,这个文件并没有从 'git status'
中消失我尝试使用 'git ls-tree' 列出树中的所有文件,发现那里存在一个文件夹名称不正确的路径。
虽然 'git status' 显示仅对一个文件进行了更改,但使用此错误路径创建提交会删除大量文件并以我无法理解的模式创建大量文件。
create mode 100644 Example/src/Example.Repository/ReflectionHelpers.cs
.....
create mode 100644 Example/src/Example.Repository/ReflectionHelpers.cs
.....
create mode 100644 Example/src/Example.Repository/ReflectionHelpers.cs
.....
delete mode 100644 Example/src/Example.Repository/ReflectionHelpers.cs
... (same for other files)
我真的不明白为什么会发生这种情况以及如何解决这个问题。预先感谢您的帮助
OS 是 Windows 10,使用 Git Bash
使用与我在“Remove a file with a strange name from git”中提到的类似的技术,尝试使用 git bash:
git mv $(printf "\txample") "Example"
# or
git rm --cached -- $(printf "\txample/")
看看重命名或删除“错误”文件夹是否至少可以使任何文件再次可访问。
OP 指的是“Unstaged changes left after git reset --hard”
git rm --cached -r .
git reset --hard
再次小心使用(这会删除任何正在进行的工作)