Easier use of Git

I’m us­ing Git as the ver­sion con­trol sys­tem for my pro­jects for some time now. Since the graph­ical user in­ter­faces are not very ma­ture yet and I like hav­ing full con­trol over everything, I’m us­ing Git on the com­mand line (i.e. Bash). In or­der to avoid en­ter­ing the same com­mands all over again, I wrote some Bash ali­ases and func­tions which ease the use of Git.

The sim­pli­fied com­mands can be down­loaded from my Git­hub re­pos­it­ory. In­struc­tions for in­stalling and us­age can be found in the README.

This is a short sum­mary of the most used com­mands:

add

Verb­ose add (ex­ecutes git add -v and then git status). All para­met­ers will be for­war­ded to git add.
Ex­ample: add -p foobar.txt

commit

Alias for git commit

gadd

Pipes the out­put of git ls-files to grep to add only those files that match a given pat­tern. All para­met­ers (in­clud­ing the pat­tern) will be for­war­ded to grep. Like add this com­mand is verb­ose and calls git status at the end.
Ex­ample: gadd -i '\.java$'

log

Alias for git log

pull

Ex­ecutes git pull --rebase and then dis­plays all com­mits since the last pull in a short format.

push

Alias for git push

st

Alias for git status

The com­mands have been tested unter msys­git, but they should also work on other plat­forms. A com­plete list can be found in the README.

In the fu­ture I may add fur­ther com­mands. I would ap­pre­ci­ate any feed­back.

Fi­nally, I want to thank Si­mon Tem­pler and Si­mon Thum for their ideas!


Posted by Michel Krämer
on June, 4th 2010.