I am using Magit and was wondering how to revert to a specific commit that contained a specific expression. First I need to find the expression across all commits content. How to do this? In command line it would be something like git grep / git log. Thanks!
Open the Magit log buffer with ll (lowercase
Customize the log with L and search for commit messages with -F or for changes with -G.
Once you entered your search value, press RET and refresh the buffer with g. You will see only commits that match your search.
Or you can directly open the log buffer with your options with l → set your options → l.
In git documentation https://git-scm.com/docs/git-log#Documentation/git-log.txt--Sltstringgt you can find more information about how to use the
Look for differences whose patch text contains added/removed lines that match . To illustrate the difference between -S --pickaxe-regex and -G, consider a commit with the following diff in the same file:
- return frotz(nitfol, two->ptr, 1, 0); ...
- hit = frotz(nitfol, mf2.ptr, 1, 0);
While git log -G"frotz(nitfol" will show this commit, git log >-S"frotz(nitfol" --pickaxe-regex will not (because the number of >occurrences of that string did not change).
Unless --text is supplied patches of binary files without a textconv >filter will be ignored.