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.
- git
- bash
- wget
- fzf
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
--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)
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.
- 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
- Validate the commit if the
-m
parameter is defined following ConventionalCommits
- Validate the commit if the
- 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
git commit rename
it will use amend internallygit commit remove [number]
it will remove the last commit based on[number]
git restage rename
it will update the indexgit rename-branch
it will use this script from Git-Extras licensed as MIT using thebuild.sh
scriptgit squash [number]
it will merge all the commits based on that number starting from the latestgit fork [repo]
it will download from GitHub the original repo and configure your fork origin as upstream
You can use complete-alias, that is a bash utility to add autocomplete to aliases, in this way for the git
command.
An alias is another command to remember, it is an external command, it does not extend another one.
This project is built with bash and Python for Linux. In order to fully approve this code's syntax use shellcheck and pylint.