I want to search across all possible refs (commits/branches/tags), all commit messages, all branch names, and all commit contents.
CodePudding user response:
Since noone suggested a chain of commands yet, and in case you did not craft it yourself already :
git config alias.findall '!f() { echo -e "\nFound in refs:\n"; git for-each-ref refs/ | grep $1; echo -e "\nFound in commit messages:\n"; git log --all --oneline --grep="$1"; echo -e "\nFound in commit contents:\n"; git log --all --oneline -S "$1"; }; f'
It chains these three commands :
# for branches and tags we use for-each-ref and pipe the result to grep
git for-each-ref refs/ | grep $1
# for commit messages we use the grep option for log
git log --all --oneline --grep="$1"
# and for commit contents log has the -S option
git log --all --oneline -S "$1"
So now you can just do
git findall something
CodePudding user response:
You can try this syntax:
alias graph="git log --all --decorate --oneline --graph"