Skip to content

Instantly share code, notes, and snippets.

@lucaswiman
Created June 10, 2017 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucaswiman/c9292dd489fb1f9e28f9632c20b61200 to your computer and use it in GitHub Desktop.
Save lucaswiman/c9292dd489fb1f9e28f9632c20b61200 to your computer and use it in GitHub Desktop.
grep co-occurrences
function git-co-occurrences() {
pattern1="$1"
pattern2="$2"
comm -12 <(git grep -E "$pattern1" | cut -d ':' -f1 | sort | uniq) <(git grep -E "$pattern2" | cut -d ':' -f1 | sort | uniq)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment