我不记得我是如何使Git GUI正确显示UTF-8编码差异的.我也找不到搜索引擎中的指南.
现在我需要在新的工作场所这样做.你能写出指示吗?
操作系统:Windows 7
我试图找到一种方法来确定git存储库中的文件是否由git-lfs正确管理.
到目前为止,我发现比较结果git lfs ls-files并且git ls-files ':(attr:filter=lfs)'似乎给了我想要的东西.
Add-Type -AssemblyName 'System.Linq';
[string[]] $actualLfsFilePaths = git lfs ls-files | `
ForEach-Object `
{
#'12345678 * my.dll' - not all lfs versions support -n flag, so it is better to be conservative
$_.Split(' ', 3)[2]
};
[string[]] $shouldBeUnderLfsFilePaths = git ls-files ':(attr:filter=lfs)';
$filePathsNotUnderLfs = [System.Linq.Enumerable]::ToArray(
[System.Linq.Enumerable]::Except($shouldBeUnderLfsFilePaths, $actualLfsFilePaths)
);
$count = $filePathsNotUnderLfs.Count;
Write-Host "There are $($count) lfs files that are not under lfs";
foreach ($filePathNotUnderLfs in $filePathsNotUnderLfs)
{
Write-Host "`t'$filePathNotUnderLfs'";
} …Run Code Online (Sandbox Code Playgroud) 对于文件名中的非ASCII字符,Git将以八进制表示法输出它们.例如:
> git ls-files
"\337.txt"
Run Code Online (Sandbox Code Playgroud)
如果这样的字节序列不表示合法编码(对于命令行的当前编码),我无法在命令行上输入相应的字符串.我怎样才能在这些文件上调用Git命令?显然,使用显示的字符串git ls-files不起作用:
> git rm "\337.txt"
fatal: pathspec '337.txt' did not match any files
Run Code Online (Sandbox Code Playgroud)
在Windows上测试,使用msysgit 1.7.10(git版本1.7.10.msysgit.1)
由于带有ä的文件名,我的git情况很糟糕.这是一个很久以来可能存在的旧文件:
因此它被标记为未跟踪\ 303\244但是如果我将其删除,则将其标记为已删除,但使用\ 314\210.很混乱.我真的不关心文件,但想知道未来...
~/d/p/uniply ??? git status master ?
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
"deployment/ec2/Prods\303\244ttning"
nothing added to commit but untracked files present (use "git add" to track)
~/d/p/uniply ??? rm deployment/ec2/Prodsättning master ?
~/d/p/uniply ??? git status master ?
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will …Run Code Online (Sandbox Code Playgroud) git ×4
diff ×1
encoding ×1
filesystems ×1
git-diff ×1
git-gui ×1
git-lfs ×1
git-ls-files ×1
macos ×1
notation ×1
octal ×1
powershell ×1
tfs ×1
utf-8 ×1