Skip to main content

Git Recursive Grep

Project description

Git Recursive Grep

PyPI version Downloads

git-rg is a command-line tool for recursively searching for files in Git repositories that contain specific text patterns using regular expressions. It's useful for finding sensitive information like accidentally committed passwords or API keys within .git directories.

Installation

pip install git-rg
python3 -m pip install git-rg
pipx install git-rg

To install latest version from Github:

pipx install git+https://github.com/s3rgeym/git-rg

Usage

git-rg <pattern> [path] [-B <num>] [-A <num>]

Arguments

  • pattern: Regular expression to search for.
  • path: Path to the directory where the search should begin (default: current directory).
  • -B, --before: Number of lines to show before the match.
  • -A, --after: Number of lines to show after the match.

Example

To search for passwords in all .git files within the current directory and show 2 lines before and after the match:

git-rg "(?i)password\s*=\s*['\"]?(\w+)['\"]?" ~/projects -B 2 -A 2

Output seems like this:

image

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_rg-0.1.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_rg-0.1.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file git_rg-0.1.2.tar.gz.

File metadata

  • Download URL: git_rg-0.1.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.6

File hashes

Hashes for git_rg-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bd93d3b530db593c821927fcd0d2c66d5e2bbdc85444165a8b5d4d988feb1540
MD5 2c34805b75614db844bcd8c455cdd7a6
BLAKE2b-256 e6a2f4579f3d08520e2b9cf07cdd752630f6b3ae1b4cf6da4438171a66581da3

See more details on using hashes here.

File details

Details for the file git_rg-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: git_rg-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.6

File hashes

Hashes for git_rg-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 309be04be5992c68191c3c229e64907301c39ad5934cd5561d2dd7926ea88f1e
MD5 7b2817991e9517ca86e6258000dada81
BLAKE2b-256 1fc29efa0fd30a2380529347149cc9fc9ebaacec5732e7fbf7951213ef0cb9c8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page