Skip to content

Latest commit

 

History

History
89 lines (64 loc) · 3.93 KB

readme.md

File metadata and controls

89 lines (64 loc) · 3.93 KB

Gitapper

Git is a difficult program to master because it can do a lot of things and often everyone needs to adapt it to their daily needs, with custom aliases and scripts. This tool creates a wrapper to the git command that will let you extend it with custom scripts (to execute before and after the real git command).

The tool is based on other projects, the first inspiration for bash wrapper and GrumPHP for their tasks system or hub that extend git with a lot of stuff.

It integrates natively Forgit for various commands in case no file or branch are defined.

For a blogpost explaination check here.

Showcase

Show gif here

Requirements

  • git
  • bash
  • wget
  • fzf

Installation

git clone https://github.com/Mte90/gitapper
cd gitapper
# Download the bash dependencies
./build.sh

# on your .bashrc
alias git=/your/path/where/you/downloaded/gitapper

Gitapper parameters

--nw    (As last command) Disable gitapper and pass all the parameters to the real git
--n    (As last command) Disable gitapper and pass -n parameter to the real git (integration with GrumPHP)

Hooks

This bash script can run a specific script before and after the git command itself (or stop the execution of git).
In this repository you can find various hooks with different requirements and usage on various commands.

Hooks scripts avalaible

  • Post-Clone
    • Auto-change directory inside the repo directory after cloning
    • Execute pip, npm or composer if the project use it
  • Pre-Add
    • If no file passed, it will use the Forgit add with FZF
  • Pre-Checkout
    • Like hub, when the branch is a GitHub pull request URL it automatically create a new branch with that content
    • Branch picker when no branch is passed will use Forgit with FZF
  • Pre-Clean
    • If no file is passed, it will use the Forgit clean with FZF
  • Pre-Commit
  • Pre-Diff
    • If no file is passed, it will use the Forgit diff with FZF
  • Pre-Log
    • If a file is passed, it will use the Forgit log with FZF
  • Pre-Rebase
    • If used with interactive parameter, it will use the Forgit rebase with FZF
  • Pre-Reset
    • If no file is passed, it will use the Forgit reset with FZF

New commands avalaible

  • git commit rename it will use amend internally
  • git commit remove [number] it will remove the last commit based on [number]
  • git restage rename it will update the index
  • git rename-branch it will use this script from Git-Extras licensed as MIT using the build.sh script
  • git squash [number] it will merge all the commits based on that number starting from the latest
  • git fork [repo] it will download from GitHub the original repo and configure your fork origin as upstream

Autocomplete support

You can use complete-alias, that is a bash utility to add autocomplete to aliases, in this way for the git command.

Why is it different from an alias?

An alias is another command to remember, it is an external command, it does not extend another one.

Verifying code style

This project is built with bash and Python for Linux. In order to fully approve this code's syntax use shellcheck and pylint.