Skip to content

Commit b9a6294

Browse files
authored
Merge pull request #36 from dscho/document-git-bash
git: provide a help page for `git-bash.exe`
2 parents 4f930a2 + 4b792dc commit b9a6294

File tree

2 files changed

+116
-2
lines changed

2 files changed

+116
-2
lines changed

mingw-w64-git/PKGBUILD

+9-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ source=("${_realname}"::"git+https://github.com/git-for-windows/git.git#tag=v$ta
4848
'start-ssh-pageant.cmd'
4949
'git-wrapper.c'
5050
'git-bash.rc'
51+
'git-bash.txt'
5152
'git-cmd.rc'
5253
'git-wrapper.rc'
5354
'gitk.rc'
@@ -102,6 +103,8 @@ prepare () {
102103
USE_ASCIIDOCTOR = YesPlease
103104
EOF
104105

106+
cp ../git-bash.txt Documentation/
107+
105108
# Slightly dirty workaround for missing docbook-xsl-ns
106109
grep -q http://docbook.sourceforge.net/release/xsl-ns/current /etc/xml/catalog || {
107110
(cd /usr/share/xml/ &&
@@ -168,8 +171,12 @@ build() {
168171
case "${pkgname[@]}" in *pdb*)
169172
make -f ../mingw-w64-git.mak STRIP=$PWD/../cv2pdb-strip STRIP_OPTS= strip-all;;
170173
esac &&
171-
make -f ../mingw-w64-git.mak sign-executables &&
172-
make -f ../mingw-w64-git.mak print-builtins | tr ' ' '\n' > builtins.txt
174+
case " $targets " in
175+
*" all "*)
176+
make -f ../mingw-w64-git.mak sign-executables &&
177+
make -f ../mingw-w64-git.mak print-builtins | tr ' ' '\n' > builtins.txt
178+
;;
179+
esac
173180
}
174181

175182
package_git () {

mingw-w64-git/git-bash.txt

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
git-bash(1)
2+
===========
3+
4+
NAME
5+
----
6+
git-bash - A Windows-specific wrapper to open a Git Bash window
7+
8+
SYNOPSIS
9+
--------
10+
[verse]
11+
git-bash [--cd-to-home] [--cd=<directory>] [--minimal-search-path]
12+
[--command=<path>] [--app-id=<id>] [<args>...]
13+
14+
DESCRIPTION
15+
-----------
16+
17+
This command opens a window with an interactive Git Bash. It is specific to the
18+
Git for Windows project.
19+
20+
By default, this will open a MinTTY window, but it can be configured in Git for
21+
Windows' installer to use Windows' default Console window instead.
22+
23+
Before starting the interactive Bash session, the environment is adjusted a
24+
bit. For example, the `PATH` is adjusted to find the `git` executable, and
25+
`git-bash` will ensure that `HOME` is set (because it is expected to be present
26+
by Git, and to point to the current user's home directory). See the
27+
<<ENVIRONMENT-VARIABLES>> section below for more information.
28+
29+
30+
OPTIONS
31+
-------
32+
33+
--cd-to-home::
34+
--no-cd::
35+
--cd=<directory>::
36+
By default, Git Bash will not change the current directory; To allow
37+
e.g. for Windows Explorer integration ("Git Bash Here"), the
38+
`--cd=<directory>` option can be used to change the current directory
39+
before running the interactive Bash.
40+
+
41+
The `--cd-to-home` option can be used to change the current directory to the
42+
user's home directory (as determined by the environment variable `HOME`). The
43+
`--no-cd` option can be used to override `--cd` options that precede it.
44+
45+
--minimal-search-path::
46+
--no-minimal-search-path::
47+
By default, Git Bash will adjust the `PATH` not only to include the
48+
`git` executable, but also all of the Unix-y tools (such as `sed`,
49+
`awk`, etc). With `--minimal-search-path`, it will be adjusted so that
50+
*only* the `git`, `git-gui` and `gitk` executables are found, as well
51+
as the scripts `start-ssh-agent.cmd` and `start-ssh-pageant.cmd`.
52+
53+
--command=<command>::
54+
Allows the user to ask for a different command to be specified.
55+
Defaults to `usr\\bin\\mintty.exe`. If the specified command is not an
56+
absolute path, it is interpreted relative to `git-bash.exe`.
57+
58+
--app-id=<command>::
59+
Allows the user to override the ID used e.g. in Windows' Task Bar.
60+
Defaults to `GitForWindows.Bash`.
61+
62+
--needs-console::
63+
--no-needs-console::
64+
--hide::
65+
--no-hide::
66+
--append-quote::
67+
--no-append-quote::
68+
These options do not make sense in the context of `git-bash`; They are
69+
merely inherited from the Git Wrapper (see the <<GIT-WRAPPER>> section
70+
below).
71+
72+
[[ENVIRONMENT-VARIABLES]]
73+
ENVIRONMENT VARIABLES
74+
~~~~~~~~~~~~~~~~~~~~~
75+
76+
Upon startup, `git-bash` will ensure that a couple of environment variables are
77+
set/adjusted.
78+
79+
The most important variable to adjust is `PATH`: Git Bash does want to make
80+
sure that the `git` executable is in the search path.
81+
82+
If `HOME` is unset, `git-bash` will first look whether `%HOMEDRIVE%%HOMEPATH%`
83+
points to a valid directory and if it does, use it as value for `HOME`. If
84+
either `HOMEDRIVE` or `HOMEPATH` are unset, or if they do not point to a valid
85+
directory, `%USERPROFILE%` is used instead.
86+
87+
[[GIT-WRAPPER]]
88+
GIT WRAPPER
89+
~~~~~~~~~~~
90+
91+
In the Git for Windows project, the source code of `git-bash` is called the
92+
"Git Wrapper", as it merely parses the command-line parameters, sets up a few
93+
environment variables, then spawns the actual command, and waits for the
94+
spawned command to exit. The Git Wrapper is not only used for `git-bash` but
95+
also for `git-cmd` and for certain placeholders internal to Git (the so-called
96+
"built-ins").
97+
98+
99+
Authors
100+
-------
101+
The "Git Wrapper" was written by Johannes Schindelin and other Git for Windows
102+
contributors.
103+
104+
GIT
105+
---
106+
Part of the linkgit:git[1] suite
107+

0 commit comments

Comments
 (0)