Skip to content

Instantly share code, notes, and snippets.

@fredlahde
Last active February 5, 2021 15:27
Show Gist options
  • Save fredlahde/18a577ac3265759b4a4b8a1da43258f0 to your computer and use it in GitHub Desktop.
Save fredlahde/18a577ac3265759b4a4b8a1da43258f0 to your computer and use it in GitHub Desktop.
Git review
git-review() {
local search="$1"
local commits=$(git --no-pager log --all --oneline --grep=$search | cut -d ' ' -f1 | paste -sd ' ')
if [ -z "$commits" ]
then
echo "No commits found for $search"
else
git show --pretty=short --show-signature $(echo $commits) | vim -
fi
}
@fredlahde
Copy link
Author

Greps the git log for commits which messages contain a given keyword. Those are then opened in vim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment