Reputation: 655
I check my git logs using git log --stat
which shows me all the commits and the files that were changed in those commits.
Now there is a commit that was made a long time ago, I remember a part of the commit message such that when I do git log --stat | grep 'message text'
the log shows only the commit messages in which 'message text' exists.
I, however need to see at least the commit id along with the grep results. How do I achieve this?
Upvotes: 1
Views: 1599
Reputation: 1542
This will find your comment.
git log --grep "search text" --author your_name
Atlassian Documentation for git log Scroll down to "By Message" for more detials.
As an aside you can use --author twice. I needed to look for a set of check-ins made by two developers. This is my favorite way to look for that needle in git's haystack. --pretty=online does two things, 1) each commit is on one line, and 2) the full commit reference number is displayed. Just using --oneline give the same except the commit reference number is abbreviated.
git log --grep "#Bug" --author jones --author smith --pretty=oneline
\dev8.4> git log --grep "#Bug" --author jones --author smith --pretty=oneline
80334597b56add0ad4a3ddd02e7a6514bf01ad1e #Bug -- Further Mods To Code - CC Save
16cc3b4e949e965de9b72eb4583fa8df659528a0 #Bug -- Use new get charge function to load CC.
b207498261b4622ef88cb696365bf9af2f3fc6e1 #Bug -- Reference now editable after CC scan.
56385b7a77e2ec9af3b827f6a9ba93c22f267e51 #Bug -- Reload Entire Page after CC charge.
19e9cb05dabd8cc7c9a80e64187821d562af043c #Bug -- force Guid after save event.
c363ed97fdc2b56d1fcd84ca48eb300dbb120a3d #Bug -- Guid was getting lost in some cases.
Upvotes: 0
Reputation: 1754
Try using this to get complete information.
git log --all --grep='Your text here'
Git Version used:
git version 2.9.0.windows.1
Example:
$ git log --all --grep='Favourite Module modifie'
Result:
commit 8226dce6f4f5ffd8143b8aefdee3b9b971040aa0
Author: Surender Singh <sure**@gmail.com> Date: Thu Aug 25 11:29:32 2016 +0530
view Favourite Module modified
Upvotes: 3
Reputation: 326
Use opts for grep to show more context lines. Choose appropriate size of num to see your id.
grep -A num -B num
Upvotes: 0
Reputation: 56462
Try using --oneline
:
git log --oneline | grep -F 'message text'
Otherwise, pipe your result through less
, and searching using less:
git log | less
/message text
Upvotes: 2