apps > git
document updated 4 months ago, on Jan 22, 2024

how to search entire repositories

fetch the latest commits from ALL branches

Before you search, you may want to pull all the latest data.

    git fetch --all

If that isn't working for you, then try this suggestion.

To verify this worked: If you're using Gitlab on the server, it shows you the commit count. You can get your local repo commit count by doing this:

    git rev-list --count --all

list most recent commits, across ALL branches

    git log --all

search for file names

This searches all filenames that occur in any commit:

    git rev-list --all | while read rev; do git ls-tree --full-tree -r --name-only "$rev" | grep '.*HelloWorld\.pm$' | sed 's/^/'"$rev"'\t/'; done

(this can easily take 30 seconds or more)

Lines further up indicate newer commits than lines further down.

search through file contents