gitsh is a new way to use Git: instead of running Git commands in a general
purpose shell like zsh or bash,
gitsh provides you with a dedicated shell just
for your Git commands.
Many of the early Unix utilities, like
dc, didn’t take sub-commands like
Git and other modern programs do, instead they launched a shell. For a program
like Git, which has so many commands and options, interacting via a shell still
makes a lot of sense, and so
gitsh follows in this long Unix tradition.
Save yourself some typing
At its simplest,
gitsh saves you from typing the word
git over and over.
Git commands are very moreish, you almost never just want one. If you work with Git, this flurry of commands is probably very familiar to you:
$ git status $ git add -p $ git commit $ git push
gitsh this gets easier:
$ gitsh gitsh@ status gitsh@ add -p gitsh@ commit gitsh@ push gitsh@ :exit $
All of your Git aliases will work in
gitsh too, so you can save
yourself even more typing.
Now we’re in a dedicated Git shell, there’s a lot more it can do than just save
us a few keystrokes.
gitsh is only concerned with Git, so it has all kinds of
little ways to make using Git easier.
What’s my status?
Of all the Git commands, I find myself using
git status most often. If I’m
about to commit, or push, or pull, it’s a great way of quickly checking where
things are up to.
gitsh, if you hit return without entering a command, we assume you wanted a
status, saving you even more typing and making it really easy to check the
status after any command.
If you prefer the more taciturn output of
git status -s, or find yourself
using a completely different command with annoying regularity, you can always
gitsh’s default command by setting the
gitsh@ config --global gitsh.defaultCommand "status -s"
Tab completion and Git prompts
gitsh you automatically get tab completion for commands, branch names, and
paths, and the name and status of the current branch in your prompt. For
example, if everything is committed and your working directory is clean the
prompt is blue and ends with
@, but if you have untracked files the prompt
is red and ends with
It is possible to set up parts of this in bash or zsh, but it can be fiddly to get working, easily broken, and can interact strangely with aliases and third-party Git commands.
Git environment variables
Like most general purpose Unix shells,
gitsh also provides environment
variables. You can set a variable using the
:set command, and read them using
gitsh@ :set message "A commit message" gitsh@ commit -m $message
If the variable name contains a dot, it will temporarily override one of your
git config settings, until the end of your
gitsh session. This is useful
when pair programming:
gitsh@ :set user.name "George Brocklehurst & Mike Burns" gitsh@ :set user.email email@example.com gitsh@ commit -m "We are pair programming!"
If you’re on Mac OS X, you can install
gitsh via Homebrew:
brew tap thoughtbot/formulae brew install gitsh
If you’re on Linux, there are install instructions in the
Don’t forget to check out the man page:
And if you do find a bug, please report it on the
gitsh GitHub repo.