1GIT-SH-SETUP(1)                   Git Manual                   GIT-SH-SETUP(1)
2
3
4

NAME

6       git-sh-setup - Common Git shell script setup code
7

SYNOPSIS

9       . "$(git --exec-path)/git-sh-setup"
10
11

DESCRIPTION

13       This is not a command the end user would want to run. Ever. This
14       documentation is meant for people who are studying the Porcelain-ish
15       scripts and/or are writing new ones.
16
17       The git sh-setup scriptlet is designed to be sourced (using .) by other
18       shell scripts to set up some variables pointing at the normal Git
19       directories and a few helper shell functions.
20
21       Before sourcing it, your script should set up a few variables; USAGE
22       (and LONG_USAGE, if any) is used to define message given by usage()
23       shell function. SUBDIRECTORY_OK can be set if the script can run from a
24       subdirectory of the working tree (some commands do not).
25
26       The scriptlet sets GIT_DIR and GIT_OBJECT_DIRECTORY shell variables,
27       but does not export them to the environment.
28

FUNCTIONS

30       die
31           exit after emitting the supplied error message to the standard
32           error stream.
33
34       usage
35           die with the usage message.
36
37       set_reflog_action
38           Set GIT_REFLOG_ACTION environment to a given string (typically the
39           name of the program) unless it is already set. Whenever the script
40           runs a git command that updates refs, a reflog entry is created
41           using the value of this string to leave the record of what command
42           updated the ref.
43
44       git_editor
45           runs an editor of user’s choice (GIT_EDITOR, core.editor, VISUAL or
46           EDITOR) on a given file, but error out if no editor is specified
47           and the terminal is dumb.
48
49       is_bare_repository
50           outputs true or false to the standard output stream to indicate if
51           the repository is a bare repository (i.e. without an associated
52           working tree).
53
54       cd_to_toplevel
55           runs chdir to the toplevel of the working tree.
56
57       require_work_tree
58           checks if the current directory is within the working tree of the
59           repository, and otherwise dies.
60
61       require_work_tree_exists
62           checks if the working tree associated with the repository exists,
63           and otherwise dies. Often done before calling cd_to_toplevel, which
64           is impossible to do if there is no working tree.
65
66       require_clean_work_tree <action> [<hint>]
67           checks that the working tree and index associated with the
68           repository have no uncommitted changes to tracked files. Otherwise
69           it emits an error message of the form Cannot <action>: <reason>.
70           <hint>, and dies. Example:
71
72               require_clean_work_tree rebase "Please commit or stash them."
73
74
75       get_author_ident_from_commit
76           outputs code for use with eval to set the GIT_AUTHOR_NAME,
77           GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit.
78
79       create_virtual_base
80           modifies the first file so only lines in common with the second
81           file remain. If there is insufficient common material, then the
82           first file is left empty. The result is suitable as a virtual base
83           input for a 3-way merge.
84

GIT

86       Part of the git(1) suite
87
88
89
90Git 2.18.1                        05/14/2019                   GIT-SH-SETUP(1)
Impressum