gera2ld / git-ass

A custom command for git to support branch alias and association.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

git-ass

A custom command for git to support branch alias and association.

  • The main script is written in pure Python 3 and has no third party dependencies.
  • The autocomplete script works for Zsh.

Installation

  1. Clone the project

    $ git clone https://github.com/gera2ld/git-ass.git
  2. Add executable path

    export PATH=$PATH:/path/to/git-ass/bin
  3. Enable autocompletion for Zsh

    # ~/.zshrc
    
    source path/to/git-ass/scripts/init.zsh

Usage

Abbreviation is recommended:

alias a='git ass'
  • Set base

    E.g. add current branch as a development branch, and expect it to be merged into the release branch release-1.0.

    $ git ass add -B release-1.0
  • Alias and description

    E.g. add alias awesome and a description to current branch.

    $ git ass add -a awesome -d 'This is an awesome branch'
  • Show information of current branch

    # Show all ancestors
    $ git ass info
    
    # Show specified property of current branch
    $ git ass info -p alias
  • List recorded branches

    $ git ass list
  • Check out branch by alias

    # Check out `awesome`
    $ git ass checkout awesome
    # or
    $ a co awesome
  • Rebase

    E.g. the current branch is a development branch and based on the release branch release-1.0 as described above, then the following command will rebase the current branch on top of the release branch.

    $ git ass rebase
  • Find a branch by alias

    $ git ass find awesome
    # or
    $ a f awesome
  • Use with git

    $ git checkout `git ass find awesome`
    # or
    $ gco `a f awesome`
  • Purge locally merged branches

    $ git ass purge
  • Prune inexistent branches

    $ git ass prune

About

A custom command for git to support branch alias and association.


Languages

Language:Python 88.0%Language:TypeScript 8.7%Language:Shell 3.3%