Skip to content

Commit d577cd2

Browse files
trastgitster
authored andcommitted
git-sh-setup: make require_clean_work_tree part of the interface
92c62a3 (Porcelain scripts: Rewrite cryptic "needs update" error message, 2010-10-19) refactored git's own checking to a function in git-sh-setup. This is a very useful thing for script writers, so document it. Signed-off-by: Thomas Rast <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 92c62a3 commit d577cd2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Documentation/git-sh-setup.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ require_work_tree::
6262
if so. Used by scripts that require working tree
6363
(e.g. `checkout`).
6464

65+
require_clean_work_tree <action> [<hint>]::
66+
checks that the working tree and index associated with the
67+
repository have no uncommitted changes to tracked files.
68+
Otherwise it emits an error message of the form `Cannot
69+
<action>: <reason>. <hint>`, and dies. Example:
70+
+
71+
----------------
72+
require_clean_work_tree rebase "Please commit or stash them."
73+
----------------
74+
6575
get_author_ident_from_commit::
6676
outputs code for use with eval to set the GIT_AUTHOR_NAME,
6777
GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit.

0 commit comments

Comments
 (0)