A bash tool to quickly add useful Git aliases to your repositories.
This repository contains bash scripts to help you manage Git aliases efficiently. Once installed globally, you can run git-add-aliases from any Git repository to add a curated set of useful aliases.
| Alias | Command | Description |
|---|---|---|
ls |
git ls |
Shows commit history with colors |
lds |
git lds |
History with short date format |
ld |
git ld |
History with relative date (e.g. 2 days ago) |
graph |
git graph |
Visual commit history as a graph |
last |
git last |
Shows the latest commit |
c |
git c "message" |
Create a commit |
cs |
git cs "message" |
Create a signed commit |
la |
git la |
List all git aliases |
- Clone this repository:
git clone https://github.com/nicktheodoridisiOS/git-add-aliases.git
#or
git clone git@github.com:nicktheodoridisiOS/git-add-aliases.git- Run the setup script:
cd git-add-aliases
bash setup.sh- Reload your shell configuration:
source ~/.zshrc # for zsh
# or
source ~/.bashrc # for bashThe script will:
- Create a
~/scriptsdirectory - Create a symlink to
git-add-aliases - Add
~/scriptsto your PATH - Make the script executable
Note: The installer supports bash, zsh, and fish shells.
If you prefer not to install globally:
- Make the script executable:
chmod +x git-add-aliases.sh- Run it directly from this directory:
./git-add-aliases.shYou can edit both scripts before installation to customize them to your needs:
Custom Installation Directory:
- Open
setup.shand change~/scriptsto your preferred directory
Custom Aliases:
- Open
git-add-aliases.shto add, remove, or modify aliases - Since the installer uses symlinks, changes will automatically apply!
Tip: Fork this repository and customize it before installation!
- Navigate to any Git repository:
cd /path/to/your/repo- Run the command:
git-add-aliases- Follow the prompts:
- Choose whether to add aliases
- If aliases already exist, choose whether to overwrite them
Note: If you haven't initialized a Git repository yet, run
git initfirst.
rm ~/scripts/git-add-aliasesRemove the command, directory, and PATH entry:
# Remove files
rm ~/scripts/git-add-aliases
rmdir ~/scripts
# Clean PATH from shell config
# For zsh:
sed -i.backup '/scripts/d' ~/.zshrc && source ~/.zshrc
# For bash:
sed -i.backup '/scripts/d' ~/.bashrc && source ~/.bashrc
# For fish:
sed -i.backup '/scripts/d' ~/.config/fish/config.fish && source ~/.config/fish/config.fishA backup of your shell configuration will be saved as .backup.
- Git (obviously!)
- bash shell
- Supported shells: bash, zsh, fish
"command not found: git-add-aliases"
- Make sure you ran
source ~/.zshrc(or your shell config) after installation - Or restart your terminal
"This is not a Git repository"
- Run
git initfirst, or navigate to an existing Git repository
Spinners not showing (rare)
- The script uses
bcfor animations, which is usually pre-installed - If missing, the script will still work fine - just without animations
- To install bc (if needed):
brew install bc(macOS) orapt install bc(Linux)
MIT License - feel free to use this however you like! 🚀