Last active
June 25, 2019 13:28
-
-
Save naiduv/0a88cc577c253aca3ddb648d81b1f3aa to your computer and use it in GitHub Desktop.
git diff all local branches for a line in a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #searches all local branches | |
| git branch | cut -d" " -f 3 | grep -Ev "^$" | while read line; do git diff $line <replace_with_file_path>; done | grep <replace_with_search_string> | |
| #example: | |
| #search diffs in all branches in the packages.json file (at the root of current directory) for the term "debug" | |
| git branch | cut -d" " -f 3 | grep -Ev "^$" | while read line; do git diff $line package.json; done | grep debug |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment