Skip to content

About

A bash tool to quickly add useful Git aliases to your repositories.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

git-add-aliases

A bash tool to quickly add useful Git aliases to your repositories.

Contents

About

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.

Available 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

Installation

Global Installation (Recommended)

  1. Clone this repository:
git clone https://github.com/nicktheodoridisiOS/git-add-aliases.git
#or
git clone git@github.com:nicktheodoridisiOS/git-add-aliases.git
  1. Run the setup script:
cd git-add-aliases
bash setup.sh
  1. Reload your shell configuration:
source ~/.zshrc  # for zsh
# or
source ~/.bashrc  # for bash

The script will:

  • Create a ~/scripts directory
  • Create a symlink to git-add-aliases
  • Add ~/scripts to your PATH
  • Make the script executable

Note: The installer supports bash, zsh, and fish shells.

Local Installation

If you prefer not to install globally:

  1. Make the script executable:
chmod +x git-add-aliases.sh
  1. Run it directly from this directory:
./git-add-aliases.sh

Customization

You can edit both scripts before installation to customize them to your needs:

Custom Installation Directory:

  • Open setup.sh and change ~/scripts to your preferred directory

Custom Aliases:

  • Open git-add-aliases.sh to add, remove, or modify aliases
  • Since the installer uses symlinks, changes will automatically apply!

Tip: Fork this repository and customize it before installation!

Usage

  1. Navigate to any Git repository:
cd /path/to/your/repo
  1. Run the command:
git-add-aliases
  1. 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 init first.

Uninstallation

Quick Removal

rm ~/scripts/git-add-aliases

Complete Cleanup

Remove 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.fish

A backup of your shell configuration will be saved as .backup.

Requirements

  • Git (obviously!)
  • bash shell
  • Supported shells: bash, zsh, fish

Troubleshooting

"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 init first, or navigate to an existing Git repository

Spinners not showing (rare)

  • The script uses bc for 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) or apt install bc (Linux)

License

MIT License - feel free to use this however you like! 🚀

About

A bash tool to quickly add useful Git aliases to your repositories.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages