8

リポジトリスイッチをブランチにクローンし、gitステータスを出力すると、ファイルの変更が表示され、git reset --hardを実行しようとしましたが、効果はありませんでした:((

git status
On branch release

Changes not staged for commit:

    modified:   htdocs/fonts/OfficinaSansBoldC.eot
    modified:   htdocs/fonts/OfficinaSansBoldC.svg
    modified:   htdocs/fonts/OfficinaSansBoldC.ttf
    modified:   htdocs/fonts/OfficinaSansBoldC.woff
    modified:   htdocs/fonts/OfficinaSansC-Book.eot
    modified:   htdocs/fonts/OfficinaSansC-Book.svg
    modified:   htdocs/fonts/OfficinaSansC-Book.ttf
    modified:   htdocs/fonts/OfficinaSansC-Book.woff

no changes added to commit 

git reset --hard origin/release

git status
On branch release

Changes not staged for commit

    modified:   htdocs/fonts/officinasansboldc.eot
    modified:   htdocs/fonts/officinasansboldc.svg
    modified:   htdocs/fonts/officinasansboldc.ttf
    modified:   htdocs/fonts/officinasansboldc.woff
    modified:   htdocs/fonts/officinasansc-book.eot
    modified:   htdocs/fonts/officinasansc-book.svg
    modified:   htdocs/fonts/officinasansc-book.ttf
    modified:   htdocs/fonts/officinasansc-book.woff

no changes added to commit 
4

3 に答える 3

9

入力する core.autocrlf を持つことの問題は、触れてはならない (バイナリ) ドキュメントであっても eol (行末) 文字を変更できることです。

試す:

git config --global core.autocrlf false
git clone /url/your/repo

(つまり、リポジトリを再度複製し、それらの差分がまだ存在するかどうかを確認します)


git 2.8 (2016 年 3 月) では、これらの変更が eol に関連しているかどうかをすばやく確認できます。

Torsten Bögershausen ( )によるcommit a7630bd (2016 年 1 月 16 日)を参照してください。( 2016 年 2 月 3 日コミット 05f1539Junio C Hamanoによってマージされました)tboegi
gitster

ls-files: eol 診断を追加

クロスプラットフォーム環境で作業している場合、ユーザーは、テキスト ファイルが正規化されてリポジトリに格納されているかどうか、および.gitattributes適切に設定されているかどうかを確認する必要がある場合があります。

Git がインデックスとワーキング ツリーの行末と有効な text/eol 属性を表示できるようにします。

行末 (" eolinfo") は次のように表示されます。

"-text"        binary (or with bare CR) file
"none"         text file without any EOL
"lf"           text file with LF
"crlf"         text file with CRLF
"mixed"        text file with mixed line endings.

有効な text/eol 属性は次のいずれかです。

"", "-text", "text", "text=auto", "text eol=lf", "text eol=crlf"

git ls-files --eol次のような出力が得られます。

i/none   w/none   attr/text=auto      t/t5100/empty
i/-text  w/-text  attr/-text          t/test-binary-2.png
i/lf     w/lf     attr/text eol=lf    t/t5100/rfc2047-info-0007
i/lf     w/crlf   attr/text eol=crlf  doit.bat
i/mixed  w/mixed  attr/               locale/XX.po

iインデックス (' ') および作業ツリー (' ')のデータで使用されている eol 規則と、表示されてwいる各パスについて有効な属性を示します。

于 2014-12-20T07:03:58.473 に答える
3

私も同じ問題に遭遇しました。コマンドを実行するgit diffと、結果は次のようになります。

Binary files a/app/webroot/font-awesome-4.4.0/fonts/fontawesome-webfont.ttf and b/app/webroot/font-awesome-4.4.0/fonts/fontawesome-webfont.ttf differ
warning: CRLF will be replaced by LF in app/webroot/font-awesome-4.4.0/fonts/fontawesome-webfont.ttf.
The file will have its original line endings in your working directory.

試してみgit reset --hard .ましたが、うまくいきませんでした。しかし、ファイルに*.ttf binary追加すると、コマンドは機能しました。.gitattributesreset

応援してください。

于 2015-10-22T03:15:45.607 に答える