4 ms·
git bisect with a grep?
by tokenizerrr 11y ago
git bisect with a grep?
- tokenizerrr 11y agoJust did this to make sure. My steps for the interested: Start with a file named `check` with the contents: grep "__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED" src/React.js && exit 1 exit 0 The commit is good if the line isn't there, the commit is bad if the line is there. Then find the first commit in the entire repository (it's 75897c2dcd1dd3a6ca46284dd37e13d22b4b16b4): git rev-list --max-parents=0 HEAD Then run: git bisect start HEAD 75897c2dcd1dd3a6ca46284dd37e13d22b4b16b4 git bisect run ./check And a few seconds later git will tell us that it was commit https://github.com/facebook/react/commit/b2ca3349c27b57b1e9462944cbe4aaaf76783d2b https://github.com/facebook/react/commit/b2ca3349c27b57b1e94...: b2ca3349c27b57b1e9462944cbe4aaaf76783d2b] Actually build react-dom file with the build running ./check React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM; b2ca3349c27b57b1e9462944cbe4aaaf76783d2b is the first bad commit commit b2ca3349c27b57b1e9462944cbe4aaaf76783d2b Author: Paul O’Shannessy <paul@oshannessy.com> Date: Tue Sep 8 10:13:24 2015 -0700 Actually build react-dom file with the build :100644 100644 8b66781299e8980740f8f9a13ad31a0cb30fd684 c20a6aa20e3d3d26c63cf3ac7ee087c93dd8a7d6 M .eslintignore :100644 100644 e99175b6a10b11857f4c6242341731af6138c3ca 3f4a02e3e372af1b04b5bb2f1ee2b4384ef22295 M Gruntfile.js :040000 040000 7e99fe9ef7324209890325e2fd9a4a430a706814 1aeab86f880dbf4366709930d7134921bee9401e M grunt :040000 040000 357233750d2d661818a5ba70ab21fe8049ab9583 154a4f6f867aa8eddc8637aadae8bd3c38e794eb M src :040000 040000 4216cc98bca3b6d6276bdfbbb29a1ca14bed1972 1e90bf75ef899c6a0ed0484c5138f4d62f32b8d4 M vendor bisect run success `git log -S` might be better for this specific case, but `git bisect` is far more powerful so it's very useful to know how it works.