Parse git log by modified files
- by MrUser
I have been told to make git messages for each modified file all one line so I can use grep to find all changes to that file. For instance:
$git commit -a
modified: path/to/file.cpp/.h - 1) change1 , 2) change2, etc......
$git log | grep path/to/file.cpp/.h
modified: path/to/file.cpp/.h - 1) change1 , 2) change2, etc......
modified: path/to/file.cpp/.h - 1) change1 , 2) change2, etc......
modified: path/to/file.cpp/.h - 1) change1 , 2) change2, etc......
That's great, but then the actual line is harder to read because it either runs off the screen or wraps and wraps and wraps.
If I want to make messages like this:
$git commit -a
modified: path/to/file.cpp/.h
1) change1
2) change2
etc......
is there a good way to then use grep or cut or some other tool to get a readout like
$git log | grep path/to/file.cpp/.h
modified: path/to/file.cpp/.h
1) change1
2) change2
etc......
modified: path/to/file.cpp/.h
1) change1
2) change2
etc......
modified: path/to/file.cpp/.h
1) change1
2) change2
etc......