|
|
||
|---|---|---|
| scripts | ||
| install-git-utils.sh | ||
| LICENSE | ||
| README.md | ||
git-utils
A collection of useful Git utilities to streamline your workflow. This repo contains scripts for tasks like cleaning up merged branches, viewing branch-specific changes, and more.
Features
git purge-branch: Automatically purges local branches that have been deleted from the remote.git changes: Shows commits in your current branch that aren't in the base branch.- More tools coming soon: Feel free to contribute new utilities for your Git workflow!
Installation
To install and use these Git utilities, follow these steps:
-
Run the installer script:
curl -sSL https://raw.githubusercontent.com/ramank775/git-utils/main/install-git-utils.sh | bashThis will:
- Install the utilities in
$HOME/.local/bin/. - Add Git aliases for each utility (e.g.,
git purge-branch,git changes). - Check if
$HOME/.local/binis in yourPATH. If not, it will notify you to add it.
- Install the utilities in
-
Optional: If
$HOME/.local/bindoes not exist, the script will prompt you to create it. -
Run a utility: After installation, you can use any of the utilities. For example:
git purge-branch git changes
Utilities
git purge-branch
This utility helps you purge local branches that have already been deleted from the remote.
Usage
git purge-branch
This will:
- Fetch the latest changes from your remote repository.
- Identify local branches that no longer exist on the remote.
- Delete those branches if they are fully merged into your current base.
git changes
This utility shows commits in your current branch that aren't in the base branch (e.g., main, master, or any branch you specify).
Usage
git changes # Compare with default remote HEAD
git changes --all # Show commits from all authors
git changes develop # Compare with a custom base branch
git changes develop --all # Custom base + all authors
What it does:
- Automatically detects the base branch (
origin/HEAD) and falls back tomainif needed. - Compares commits from base to your current branch.
- By default, filters by your Git user email. Use
--allto show commits from everyone.
Add More Utilities
If you want to add more utilities to this toolkit, you can:
- Create a new script in the
scripts/directory. - Add it to the
SCRIPTSarray in theinstall-git-utils.shinstaller script. - Submit a pull request or simply use it locally!
License
This project is licensed under the MIT License – see the LICENSE file for details.
Contributing
Feel free to contribute new utilities, fixes, or enhancements. Follow these steps to contribute:
- Fork the repo.
- Clone your fork:
git clone https://github.com/{YOUR_USERNAME}/git-utils.git - Create a new branch for your changes.
- Make your changes and commit them.
- Push your changes to your fork.
- Create a pull request.
Acknowledgments
- Inspired by many open-source Git utilities.