LoginSignup
1
6

More than 5 years have passed since last update.

Gitリポジトリの改行コードを一括置換する

Last updated at Posted at 2018-10-10

コマンド

CRLF→LFの場合
LF→CRLFの場合はunix2dosを使えば同様にできそう(試してない)

$ git --version
git version 2.19.1.windows.1
$ git grep --cached -l -I $'\r$' | xargs dos2unix

git grep のオプション

--cached

Instead of searching tracked files in the working tree, search blobs registered in the index file.

ワーキングツリー内の追跡されたファイルを探さず、インデックスファイルに登録されたブロブを探す。

-I

Don’t match the pattern in binary files.

バイナリファイル内のパターンにはマッチさせない。

-l
--files-with-matches
--name-only
-L
--files-without-match

Instead of showing every matched line, show only the names of files that contain (or do not contain) matches. For better compatibility with git diff, --name-only is a synonym for --files-with-matches.

マッチした行は表示せずファイル名だけを表示する。

オプション解説でどころ
Git - git-grep Documentation

1
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
6