3.5 KiB
git-shortmaps provides very concise (mostly one- and two-character), user-configurable commands for Git with support for Bash tab completion.
shortmaps / Bash Completion
The bash_completion
file contains Bash completion for custom commands and
"shortmappings", which provide single-character aliases to common Git commands.
Setup
Source the bash_completion
file (e.g. place in .bashrc
or in
/etc/bash_completion.d/
on Debian systems), with the path to the provided
shortmaps
file as the only argument:
$ . bash_completion ./shortmaps
You may also add your own mappings to ~/.git-shortmaps
, which is sourced
automatically and will take precedence over any other mappings.
Usage
By default, the following mappings are available, each with tab completion:
a
- git addA
- git add -AAS
- git add -A && git pushb
- git branchbd
- git branch --deletebd-
- delete branch@{-1}
bv
- git branch -vB
- git bisectBs
- git bisect startBg
- git bisect goodBb
- git bisect badBr
- git bisect resetc
- git commitca
- git commit --amendco
- git checkoutC
- git commit -amCS
- git commit -S -amd
- git diffds
- git diff --statf
- git fetchL
- git log --show-signatureLd
- git log --show-signature --decorateLf
- git log --show-signature --first-parentLg
- git log --show-signature --graphLgd
- git log --show-signature --graph --decorateLm
- git log --show-signature --mergesLn
- git log --show-signature --no-mergesm
- git mergema
- git merge --abortmm
- git merge --no-ffM
- git submoduleMi
- git submodule update --init --recursiveMu
- git submodule updateMP
- git submodule update --remotep
- git pushpu
- git push --set-upstreamP
- git pullPr
- git pull --rebase=preservePrp
- git pull --rebase=preserve && git pushr
- git resetr@
- git reset @r@:
- git reset @ :/r@*
- git reset @ *rh
- git reset HEAD :/R
- git rebaseRi
- git rebase --interactiveRa
- git rebase --abortRc
- git rebase --continues
- git status --shortS
- git stashSa
- git stash applySl
- git stash listSp
- git stash popSs
- git stash showt
- execute tigT
- git tag-
- git checkout ---
-cd
to root dir of repository?
- display all shortmaps
The shortmaps may only be used within a Git repository; otherwise, they will invoke the actual command on the system.
If a shortmap conflicts with an existing command on your system, then you
may either unalias the map, or use command X
to invoke the system command
X
.
Configuration
The file format is as follows:
key completion :cmd
key completion |cmd
key completion cmd
If cmd
contains a colon (:
) prefix, the command will be prefixed with
git
. If prefixed with a pipe (|
), the command will be sent to eval
(needed for certain features like subshells). Commands without either prefix
will be executed normally.
License
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.