Git:git grepコマンドでファイルの区切りとして空行を表示する方法

スポンサーリンク

git grepコマンドでファイルの区切りとして空行を表示する方法

git grepコマンドでファイルの区切りとして空行を表示するには--breakオプションを指定します。

 

オプションの説明

 --break
     Print an empty line between matches from different files.

 

--breakオプションを指定した場合

$ git grep --break time_t | head
Documentation/RelNotes/2.14.0.txt: * Some platforms have ulong that is smaller than time_t, and our

Documentation/git-grep.txt:`git grep 'time_t' -- '*.[ch]'`::
Documentation/git-grep.txt:     Looks for `time_t` in all tracked .c and .h files in the working

archive-zip.c:  time_t time;
archive-zip.c:  time = (time_t)*timestamp;

archive.c:      time_t archive_time;

 

--breakオプションを指定しない場合

$ git grep time_t | head
Documentation/RelNotes/2.14.0.txt: * Some platforms have ulong that is smaller than time_t, and our
Documentation/git-grep.txt:`git grep 'time_t' -- '*.[ch]'`::
Documentation/git-grep.txt:     Looks for `time_t` in all tracked .c and .h files in the working
archive-zip.c:  time_t time;
archive-zip.c:  time = (time_t)*timestamp;
archive.c:      time_t archive_time;
blame.c:        time_t now;
builtin/bugreport.c:    time_t now = time(NULL);
builtin/pack-objects.c: time_t last_mtime = 0;
commit-graph.c: time_t now = time(NULL);