From 570ec471d1605318aeefb030cd78682ae442235b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 31 Mar 2025 21:51:40 -0300 Subject: src/content/: Update all files left to asciidoc --- src/content/tils/2020/08/16/git-search.adoc | 51 +++++++++++------------------ 1 file changed, 20 insertions(+), 31 deletions(-) (limited to 'src/content/tils/2020/08/16') diff --git a/src/content/tils/2020/08/16/git-search.adoc b/src/content/tils/2020/08/16/git-search.adoc index f3ae6f0..5ad0eae 100644 --- a/src/content/tils/2020/08/16/git-search.adoc +++ b/src/content/tils/2020/08/16/git-search.adoc @@ -1,59 +1,48 @@ ---- - -title: Search in git - -date: 2020-08-16 - -layout: post - -lang: en - -ref: search-in-git - -eu_categories: git - ---- += Search in git Here's a useful trio to know about to help you search things in git: -1. `git show ` -2. `git log --grep=''` -3. `git grep '' [commit]` +. `git show ` +. `git log --grep=''` +. `git grep '' [commit]` -## 1. `git show ` +== 1. `git show ` Show a specific commit and it's diff: -```shell +[source,shell] +---- git show # shows the latest commit git show # shows an specific git show v1.2 # shows commit tagged with v1.2 -``` +---- -## 2. `git log --grep=''` +== 2. `git log --grep=''` Search through the commit messages: -```shell +[source,shell] +---- git log --grep='refactor' -``` +---- -## 3. `git grep '' [commit]` +== 3. `git grep '' [commit]` + +:browse-article: link:../14/browse-git.html Search content in git history: -```shell +[source,shell] +---- 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 -[use git checkout for that][0]. - -[0]: {% link _tils/2020-08-14-browse-a-git-repository-at-a-specific-commit.md %} +browse the repository in that point in time, you can {browse-article}[use git +checkout for that]. -- cgit v1.2.3