These are some bash aliases and functions that make the average git user's life easier. The commands have been tested under msysgit but they should work on other platforms too.
Clone the repository into your home directory:
cd ~ git clone git://github.com/michel-kraemer/gitaliases.git
Include gitaliases.sh
in your .bashrc
:
echo source ~/gitaliases/gitaliases.sh >> ~/.bashrc
The following aliases are provided:
add
Verbose add (executes
git add -v
and thengit status
). All parameters will be forwarded togit add
.Example:add -p foobar.txt
branch
- Alias for
git branch
checkout
- Alias for
git checkout
cherry-pick
- Alias for
git cherry-pick
commit
- Alias for
git commit
fetch
- Alias for
git fetch
g
- Alias for
git
gadd
Pipes the output of
git ls-files
togrep
to add only those files that match a given pattern. All parameters (including the pattern) will be forwarded to grep. Likeadd
this command is verbose and callsgit status
at the end.Example:gadd -i '\.java$'
greset
Pipes the output of
git ls-files
togrep
to reset only those files that match a given pattern. All parameters (including the pattern) will be forwarded to grep. Likereset
this command callsgit status
at the end.Example:greset 'bin'
log
- Alias for
git log
merge
- Alias for
git merge
pull
- Executes
git pull --rebase
and then displays all commits since the last pull in a short format. push
- Alias for
git push
rebase
- Alias for
git rebase
reset
- Verbose reset (executes
git reset -v
and thengit status
). All parameters will be forwarded togit reset
. st
- Alias for
git status
stash
- Alias for
git stash
Special thanks to Simon Templer and Simon Thum for their input!
This work is licensed under the MIT license:
Copyright (c) 2010 Michel Kraemer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.