How do I avoid typing "git" at the begining of every Git command? How do I avoid typing "git" at the begining of every Git command? git git

How do I avoid typing "git" at the begining of every Git command?


You might want to try gitsh. From their readme:

The gitsh program is an interactive shell for git. From within gitsh you can issue any git command, even using your local aliases and configuration.

  • Git commands tend to come in groups. Avoid typing git over and over and over by running them in a dedicated git shell:
sh$ gitshgitsh% statusgitsh% add .gitsh% commit -m "Ship it!"gitsh% pushgitsh% ctrl-dsh$

Or have a look at the other projects linked there:

  • git-sh - A customised bash shell with a Git prompt, aliases, and completion.
  • gitsh - A simple Git shell written in Perl.
  • repl - Wraps any program with subcommands in a REPL.

Note: Haven't used this myself.


A Perl one-liner which will do this:

perl -nE 'BEGIN {print "git > "} system "git $_"; print "git > "'

This will execute whatever you type, prefixed with git. And it will keep doing that until you hit ^D.


This is not exactly what you're asking for, but you could set up some shell aliases in your ~/.bashrc for the Git commands you use most frequently:

alias commit='git commit'alias checkout='git checkout'...

Also note that you can create aliases within Git itself:

git config --global alias.ci commitgit config --global alias.co checkout...

This lets you type git ci instead of git commit, and so on.