Run commands for each git commit
Find a file
2024-03-27 16:43:21 +01:00
src add streaming flag 2024-03-27 16:43:21 +01:00
.gitignore init 2024-03-09 23:40:36 +01:00
Cargo.lock add streaming flag 2024-03-27 16:43:21 +01:00
Cargo.toml add streaming flag 2024-03-27 16:43:21 +01:00
README.md add readme + env vars + status code 2024-03-27 16:26:38 +01:00

Giterator

Ever wondered why Git histories exist if we just ignore them? Giterator is a powerful command-line tool designed to simplify your Git workflow by providing seamless iteration over commit histories. Explore your project's evolution effortlessly, perform analyses, execute scripts, and generate output in various formats.

Usage

Count Lines of Code (LoC) Over Time

# Count lines of code in Rust files over time
giterator 'find . -type f -name "*.rs" -exec cat {} + | wc -l'

Explore Commits in Another Repository

giterator command other_repo

Execute Custom Script over each Commit

# Run a custom script (myscript.sh) on each commit in a repository
giterator --script myscript.sh on_my_repo

Output in JSON Format

# Generate JSON output for commit analysis
giterator --json command

Output in CSV Format

# Generate CSV output for commit analysis
giterator --csv command

Environment Variables

When running a custom script or command with Giterator, the following environment variables are automatically exposed:

  • $GIT_REPO: The name of the repository being iterated over.
  • $COMMIT_HASH: The hash of the current commit being processed.
  • $COMMIT_DATETIME: The date and time of the current commit being processed.
  • $COMMIT: The name of the current commit being processed.

These environment variables allow your custom script or command to access important information about the repository and the current commit being iterated over. You can use these variables to customize the behavior of your script or command.