git-sh -- a git shell
git-sh starts an interactive
bash(1) session modified for git-heavy
workflows. Typical usage is to change into the directory of a git work tree or
bare repository and run the
git-sh command to start an interactive shell
Top-level command aliases are created for all core
git(1) subcommands, git-sh
builtin aliases (see BUILTIN ALIASES), and git command aliases defined in
git-sh loads a set of standard aliases in addition to all core git commands. The builtin aliases are overridden by aliases defined in the user or system gitconfig files.
Anything defined in the
[alias] section of the repository, user, or system git
config files are also available as top-level shell commands. Assuming a
~/.gitconfig that looked like this:
[alias] ci = commit --verbose ca = commit -a d = diff s = status thanks = !git-thanks
... you might then have the following shell session:
master!something> echo "stuff" >somefile master!something*> s M somefile master!something*> d diff --git a/somefile b/somefile -- a/somefile ++ b/somefile @@ -0,0 +1 @@ + stuff master!something*> ca -m "add stuff" master!something> thanks HEAD
The default prompt shows the current branch, a bang (
!), and then the relative
path to the current working directory from the root of the work tree. If the
work tree includes modified files that have not yet been staged, a dirty status
*) is also displayed.
The git-sh prompt includes ANSI colors when the git
color.ui option is set and
enabled. To enable git-sh's prompt colors explicitly, set the
$ git config --global color.sh auto
Customize prompt colors by setting the
color.sh.dirty git config values:
$ git config --global color.sh.branch 'yellow reverse' $ git config --global color.sh.workdir 'blue bold' $ git config --global color.sh.dirty 'red'
See colors in git for information.
Bash completion support is automatically enabled for all git built-in commands
and also for aliases defined in the user
~/.gitconfig file. The auto-completion
logic is smart enough to know an alias
d that expands to
git-diff should use
the same completion configuration as the
The completion code is a slightly modified version of the git bash completion
script shipped with the core git distribution. The script is built into the
git-sh executable at compile time and need not be obtained or installed
git-sh behavior can be configured by editing the user or system gitconfig
/etc/gitconfig) either by hand or using
[alias] section is used to create basic command aliases.
~/.gitshrc files are sourced (in that order)
immediately before the shell becomes interactive.
~/.bashrc file is sourced before either
Any bash customizations defined there and not explicitly overridden by
are also available.
Set to the dynamic git-sh prompt. This can be customized in the
Explicitly set the path to the git repository instead of assuming the
Explicitly set the path to the root of the work tree instead of assuming
the nearest parent directory with a
bash(1), git(1), git-config(1)