| Crates.io | tracegit |
| lib.rs | tracegit |
| version | 0.2.1 |
| created_at | 2025-06-02 10:50:31.397771+00 |
| updated_at | 2025-06-02 11:05:08.808971+00 |
| description | A CLI tool to trace the last commit where a script was working fine |
| homepage | |
| repository | https://github.com/sirajjunior540/tracegit.git |
| max_upload_size | |
| id | 1697844 |
| size | 39,608 |
A command-line tool that helps you find the last working commit for a specific file in your Git repository. This is especially useful for debugging regressions in large codebases.
Have you ever made changes to your code and suddenly found that a script or feature that was working before now fails? This tool helps you identify exactly when the problem was introduced by:
If you're using a Mac with Apple Silicon (M1, M2, M3, M4), you might need to ensure that your Rust toolchain is set up for the arm64 architecture:
# Check your current Rust target
rustc --print target-list | grep aarch64
# If needed, add the aarch64-apple-darwin target
rustup target add aarch64-apple-darwin
You may also need to install the Xcode Command Line Tools:
xcode-select --install
If you encounter issues with the git2 dependency, make sure you have the required libraries:
brew install libgit2 openssl
The easiest way to install tracegit is directly from crates.io:
# Install the latest version
cargo install tracegit
This will install the binary to your Cargo bin directory (usually ~/.cargo/bin/), which should be in your PATH.
# Clone the repository
git clone https://github.com/sirajjunior540/tracegit.git
cd tracegit
# Build the project
cargo build --release
# The binary will be available at target/release/tracegit
# Optionally, install it to your PATH
cargo install --path .
To update to the latest version:
# Update from crates.io
cargo install tracegit --force
If you're seeing an old version (e.g., v0.1.0) after updating the repository, it's likely because:
To remove tracegit from your system:
cargo uninstall tracegit
Basic usage:
tracegit --file=path/to/your/script.py --cmd="python"
This will:
python path/to/your/script.py at each commitOPTIONS:
-f, --file <FILE> Path to the file to check
-c, --cmd <CMD> Command to run to check if the file works
-r, --repo-path <REPO_PATH> Path to the Git repository [default: .]
-R, --restore <RESTORE> Restore the working tree to the original state after completion [default: true]
-v, --verbose Enable verbose output
-p, --pytest Use pytest shorthand mode (automatically formats pytest command)
-t, --test <TEST> Test name for pytest (class::method format, used with --pytest)
-h, --help Print help information
-V, --version Print version information
Find when a Python script stopped working:
tracegit --file=scripts/analyze.py --cmd="python" --verbose
Find when a test started failing:
tracegit --file=tests/unit_test.js --cmd="npm test" --verbose
Find when a Python test started failing using pytest:
tracegit --file=tests/test_feature.py --cmd="pytest" --verbose
Find when a specific pytest test started failing using the pytest shorthand mode:
tracegit --file=tests/test_feature.py --pytest --verbose
Find when a specific pytest test method started failing using the pytest shorthand mode:
tracegit --file=tests/test_feature.py --pytest --test="TestClass::test_method" --verbose
The above command is equivalent to:
tracegit --file=tests/test_feature.py --cmd="pytest tests/test_feature.py::TestClass::test_method" --verbose
Check a specific repository:
tracegit --file=app.js --cmd="node" --repo-path=/path/to/repository
The tool uses the following process:
The tool provides two levels of logging:
--verbose): Shows detailed debugging informationThis project is licensed under the MIT License - see the LICENSE file for details.