Skip to content

Instantly share code, notes, and snippets.

@bfolliot
Last active June 28, 2016 07:57
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 bfolliot/7db382a3d02f10e5d817e7b868c57f63 to your computer and use it in GitHub Desktop.
Save bfolliot/7db382a3d02f10e5d817e7b868c57f63 to your computer and use it in GitHub Desktop.
Git search
[alias]
search = "!f() { git log --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%an %cr)%Creset' --abbrev-commit --date=relative --branches --all --grep=$1; }; f"
search-b = "!f() { for i in $(git log --pretty=format:%h --all --grep=$1 --branches); do git log -1 --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%an %cr)%Creset' --abbrev-commit --date=relative $i && git branch -a --contains $i; done }; f"
@bfolliot
Copy link
Author

Usages :

$ git search "toto" # Affiche simplement le log des commits qui contiennent toto
$ git search-b "toto" # Affiche le log avec pour chaque commit la liste des branches

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