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$ gitsh
gitsh% status
gitsh% add .
gitsh% commit -m "Ship it!"
gitsh% push
gitsh% ctrl-d
sh$

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 commit
git config --global alias.co checkout
...

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


I'm a big fan of using aliases in ~/.bash_profile for my GitBash. If you go with this approach, here are some of my favorites:

# git
alias gw='git whatchanged'
alias gg='git grep -n -C8'
alias ggi='git grep -i -n -C8'
alias gb='git branch'
alias gbd='git branch -D'
alias gba='git branch -a'
alias gc='git checkout'
alias gcp='git cherry-pick'
alias gfo='git fetch origin'
alias s='git status'
alias gmom='git merge origin/master'
alias grom='git rebase origin/master'
alias gpom='git pull origin master'
alias pplog='git log --oneline --graph --decorate'

Use your editor.

Type the command like commit from your favorite editor like vs code and be more efficient with git:

enter image description here

Or type git to get all the commands:

enter image description here