Suppose you need to know what commit or date some string was introduced into your code. A good example of this is a trademark, but this could apply to any string.
How to find the approximate date and file:
- Sync repo to some date
- Use command “ag” with the option to ignore node_modules to search for just part of the trademark string in case of returns, formatting, etc. (note,
brew install agif you don’t have ag)
✗ cd <project> ✗ git checkout `git rev-list -n 1 --before="2016-06-01 13:37" master` && ag --ignore node_modules "<some string>" . HEAD is now at f84a0bc2d... app/views/pages/some-file.html.slim . 13: <some text result> ✗ git checkout `git rev-list -n 1 --before="2016-04-01 13:37" master` && ag --ignore node_modules "<some string>" . Previous HEAD position was f84a0bc2d... HEAD is now at f48a1d4ea... <nothing shows up>
Then look at the history of the file that matches:
gitk log <some file>