diff options
author | EuAndreh <eu@euandre.org> | 2025-04-30 06:23:27 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-04-30 06:33:36 -0300 |
commit | 61ffa8466bbfa4ca8b13b442a3bd63ef9504a6da (patch) | |
tree | fc3c799bece509682b712f6e42e2816059c83c7a /src/content/en/til/2020/08/16/git-search.adoc | |
parent | Makefile: No need to remove non-generated *.mo files (diff) | |
download | euandre.org-61ffa8466bbfa4ca8b13b442a3bd63ef9504a6da.tar.gz euandre.org-61ffa8466bbfa4ca8b13b442a3bd63ef9504a6da.tar.xz |
src/content/en/: Unpluralize collection names
Diffstat (limited to 'src/content/en/til/2020/08/16/git-search.adoc')
-rw-r--r-- | src/content/en/til/2020/08/16/git-search.adoc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/content/en/til/2020/08/16/git-search.adoc b/src/content/en/til/2020/08/16/git-search.adoc new file mode 100644 index 0000000..4113f3f --- /dev/null +++ b/src/content/en/til/2020/08/16/git-search.adoc @@ -0,0 +1,49 @@ += Search in git +:categories: git + +Here's a useful trio to know about to help you search things in git: + +. `git show <commit>` +. `git log --grep='<regexp>'` +. `git grep '<regexp>' [commit]` + +== 1. `git show <commit>` + +Show a specific commit and it's diff: + +[source,sh] +---- +git show +# shows the latest commit +git show <commit> +# shows an specific <commit> +git show v1.2 +# shows commit tagged with v1.2 +---- + +== 2. `git log --grep='<regexp>'` + +Search through the commit messages: + +[source,sh] +---- +git log --grep='refactor' +---- + +== 3. `git grep '<regexp>' [commit]` + +:browse-article: link:../14/browse-git.html + +Search content in git history: + +[source,sh] +---- +git grep 'TODO' +# search the repository for the "TODO" string +git grep 'TODO' $(git rev-list --all) +# search the whole history for "TODO" string +---- + +And if you find an occurrence of the regexp in a specific commit and you want to +browse the repository in that point in time, you can {browse-article}[use git +checkout for that]. |