/git-tools

Git Aliases and Commands

Primary LanguagePythonMIT LicenseMIT

Git Tools

Git aliases and commands

Overview

Git Tools is a collection of Git aliases and convenience commands that I use in my development workflow. I've packed them up to make them easy to share and keep up-to-date across my various development environments. You're welcome to use them and I'd love contributions.

Installation

  1. Clone the repository:

    mkdir -p ~/Projects
    cd ~/Projects
    git clone git@github.com:jbmorley/git-tools.git
  2. Update the submodules:

    git submodule update --init
    
  3. Include the Git Tools configuration file in your local Git configuration. For example, if you've cloned this repository to ~/Projects/git-tools, then you would add the following section to yout ~/.gitconfig:

    [include]
    
        path = ~/Projects/git-tools/config
    

Updates

git gt-update

Commands

Git Tools adds the following additional git commands, many of which are simply shorter forms to avoid the need to type too much:

  • br – alias for branch
    git branch
  • ci – alias for commit
    git commit
  • co – alias for checkout
    git checkout
  • d – alias for diff
    git diff
  • dc – show the cached changes
    git diff --cached
  • del – interactive delete branch
  • dt – alias for difftool
    git difftool
  • gt-install – install Git Tools dependencies
  • gt-install-directory – echo Git Tools install directory
  • gt-update – update Git Tools installation
  • list-aliases – list all aliases
    git config --get-regexp ^alias
  • p – push
    git push
  • pf – force push with lease
    git push --force-with-lease
  • pr – create a new PR on GitHub (requires the GitHub CLI to be installed)
    gh pr create -w
  • s – alias for status
    git status
  • sha – alias for rev-parse HEAD
    git rev-parse HEAD
  • sl
  • sla
  • st – alias for status
    git status
  • unstage – unstage the current changes
    git reset HEAD --
  • up – fetch and rebase onto origin/main
    git fetch origin -p
    git rebase origin/main --autostash
    git submodule update --init --recursive