Setup and Config
There are two commands that are used quite a lot, from the first invocations of Git to common every day
tweaking and referencing, the config and help commands.
git config
Git has a default way of doing hundreds of things. For a lot of these things, you can tell Git to default to
doing them a different way, or set your preferences. This involves everything from telling Git what your
name is to specific terminal color preferences or what editor you use. There are several files this
command will read from and write to so you can set values globally or down to specific repositories.
The git config command has been used in nearly every chapter of the book.
In First-Time Git Setup we used it to specify our name, email address and editor preference before we
even got started using Git.
In Git Aliases we showed how you could use it to create shorthand commands that expand to long
option sequences so you don’t have to type them every time.
In Rebasing we used it to make --rebase the default when you run git pull.
In Credential Storage we used it to set up a default store for your HTTP passwords.
In Keyword Expansion we showed how to set up smudge and clean filters on content coming in and out
of Git.
Finally, basically the entirety of Git Configuration is dedicated to the command.
git config [Link] commands
Accompanying the configuration instructions in Your Editor, many editors can be set as follows:
Editor Configuration command
Atom ------> git config --global [Link] "atom --wait"
Emacs ------> git config --global [Link] emacs
Gedit (Linux) ------> git config --global [Link] "gedit --wait --new-window"
Gvim (Windows 64-bit)------> git config --global [Link] "'C:\Program Files\Vim\vim72\[Link]'
--nofork '%*'" (Also see note below)
Kate (Linux)------> git config --global [Link] "kate"
nano------> git config --global [Link] "nano -w"
Notepad (Windows 64-bit)------> git config [Link] notepad
Notepad++ (Windows 64-bit)------> git config --global [Link] "'C:\Program
Files\Notepad\[Link]' -multiInst -notabbar -nosession -noPlugin" (Also see note below)
Scratch (Linux)------> git config --global [Link] "scratch-text-editor"
Sublime Text (macOS)------> git config --global [Link] "/Applications/Sublime\
[Link]/Contents/SharedSupport/bin/subl --new-window --wait"
Sublime Text (Windows 64-bit)------> git config --global [Link] "'C:\Program Files\Sublime Text
3\sublime_text.exe' -w" (Also see note below)
TextEdit (macOS)------> git config --global [Link] "open --wait-apps --new -e"
Textmate ------> git config --global [Link] "mate -w"
Textpad (Windows 64-bit)------> git config --global [Link] "'C:\Program Files\TextPad 5\[Link]'
-m (Also see note below)
UltraEdit (Windows 64-bit) ------> git config --global [Link] Uedit32
Vim ------> git config --global [Link] "vim"
Visual Studio Code ------> git config --global [Link] "code --wait"
VSCodium (Free/Libre Open Source Software Binaries of VSCode)------> git config --global [Link]
"codium --wait"
WordPad ------> git config --global [Link] '"C:\Program Files\Windows
NT\Accessories\[Link]"'"
Xi ------> git config --global [Link] "xi --wait"
If you have a 32-bit editor on a Windows 64-bit system, the program will be installed in C:\Program Files
(x86)\ rather than C:\Program Files\ as in the table above.
git help
The git help command is used to show you all the documentation shipped with Git about any command.
While we’re giving a rough overview of most of the more popular ones in this appendix, for a full listing
of all of the possible options and flags for every command, you can always run git help <command>.
We introduced the git help command in Getting Help and showed you how to use it to find more
information about the git shell in Setting Up the Server.