A collection of useful git helper scripts to make your git workflow more efficient.
List branches that have received commits within a specified time period.
Usage:
git-active-branches [--months=N] [--details]Options:
--months=N: Show branches with commits in the last N months (default: 6)--details: Show detailed commit history for each branch (last 10 commits with date, SHA, author, and subject)
Examples:
# List branches with commits in the last 6 months
git-active-branches
# List branches with commits in the last 12 months
git-active-branches --months 12
# Show detailed commit history
git-active-branches --details
# Combine options
git-active-branches --months 12 --detailsFind all branches that contain a specific commit.
Usage:
git-find-branch-from-commit <commit-sha>Arguments:
<commit-sha>: The commit SHA to search for (minimum 8 characters)
Examples:
# Find branches containing a commit
git-find-branch-from-commit abc12345
# Using full SHA
git-find-branch-from-commit abc1234567890def- Clone this repository:
git clone https://github.com/stulluk/my-git-helpers.git
cd my-git-helpers- Install scripts (choose one method):
Option 1: Copy to /usr/bin (system-wide, requires sudo):
sudo cp git-active-branches git-find-branch-from-commit /usr/bin/
sudo chmod +x /usr/bin/git-active-branches /usr/bin/git-find-branch-from-commitOption 2: Add to your PATH:
# Add to your PATH in ~/.bashrc or ~/.zshrc
export PATH="$PATH:$(pwd)"Option 3: Create symlinks in a directory already in your PATH:
ln -s $(pwd)/git-active-branches ~/bin/
ln -s $(pwd)/git-find-branch-from-commit ~/bin/- (Optional) Enable bash completion:
# Add to your ~/.bashrc for persistent completion
source /usr/bin/git-active-branches 2>/dev/null
source /usr/bin/git-find-branch-from-commit 2>/dev/nullNote: Scripts are already executable, but if needed:
chmod +x git-active-branches git-find-branch-from-commit- Git
- Bash
- Standard Unix utilities (date, sort, awk, etc.)
MIT