1 stable release

2.0.0 Oct 14, 2024

#105 in Build Utils

Custom license

1MB
343 lines

gitrack

Table of Contents generated with mtoc

About

Scan git repositories in your file system. Find untracked changes, diff files, and more.

Easy and simple. This tool was created just for fun and to practice Rust.

Implemented features:

  • Scan for untracked changes in git repositories.
  • Scan .git folders in your file system (with multithreads).
  • Diff files for untracked changes.

Badges

Language Rust
Release Release
Code Code Size
CI - Build Build
CI - Release Build
CI - Test Build
Meta pre-commit License - MIT
Codecov Codecov
Downloads Downloads

Supported Platforms

Arch ARM64 AMD64
darwin
linux

Installation

Install latest version

curl --proto '=https' --tlsv1.2 -sSfL https://raw.githubusercontent.com/containerscrew/gitrack/main/install.sh | sh

Install specific release

curl --proto '=https' --tlsv1.2 -sSfL https://raw.githubusercontent.com/containerscrew/gitrack/main/install.sh | sh -s -- -v "v0.8.0"

Using cargo

Open a terminal and run:

git clone https://github.com/containerscrew/gitrack
cd gitrack
make install

Uninstall

sudo rm /usr/local/bin/gitrack

With cargo:

make uninstall

Usage

Help

gitrack --help

Scan git repositories in your file system

Usage: gitrack [OPTIONS]

Options:
  -p, --path <PATH>               Folder path you want to scan for git untracked files [default: /home/dcr]
  -w, --workers <WORKERS>         Number of threads to use for scanning repositories [default: 5]
  -d, --diff                      Show differences between changed files
  -e, --exclude-dir <EXCLUDE>...  Exclude directories to scan
  -u, --check-untracked           Only show repositories with untracked files
  -v, --verbose                   Print verbose output
  -h, --help                      Print help
  -V, --version                   Print version

Scan folders containing git repositories

gitrack -p /home/elliot # home will be always the default values if -p is not provided

Scanning for untracked changes (summarized)

gitrack -p /home/elliot -u

Scanning for untracked changes (verbose)

gitrack -p /home/elliot -u -v

Diff files for untracked changes

gitrack -p /home/elliot -u -d # without -u, -d will not work

Control number of workers/threads

gitrack -p /home/elliot -u -w 6

Exclude directories

gitrack -p /home/elliot -e "/home/elliot/.cache" -e "/home/elliot/.local" -u -w 6

About threads

The use of threads is not really necessary in this type of tools, unless you have a very large file/folder system. Adding threads does not mean always better performance. I have included them in order to practice their use.

Dev

pre-commit

cd gitrack/
pre-commit install

Local container

cd gitrack/
docker run -it --rm -w /app -h gitrack --name gitrack -v $PWD:/app docker.io/rust:1.80.1-slim-bullseye

Examples

Scan folder containing git repositories

example1

Scan untracked repositories

example2

Scan untracked repositories with verbose

example3

Diff files

example4

Exclude directories

example5

TODO

  • Implement git commit scan for sensitive data using regex. Just for fun. Like gitleaks does.

License

License

Dependencies

~12–23MB
~419K SLoC