Documentation/git-worktree: add EXAMPLES section
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Sunshine committed
Jul 6, 2015 at 13:30 UTC
96454597562dade701fbfee19891482a97456138
1 file changed
+22
Documentation/git-worktree.txt
+22
@@ -105,6 +105,28 @@ to `/path/main/.git/worktrees/test-next` then a file named
105
`test-next` entry from being pruned. See
106
linkgit:gitrepository-layout[5] for details.
107
108
+EXAMPLES
109
+--------
110
+You are in the middle of a refactoring session and your boss comes in and
111
+demands that you fix something immediately. You might typically use
112
+linkgit:git-stash[1] to store your changes away temporarily, however, your
113
+worktree is in such a state of disarray (with new, moved, and removed files,
114
+and other bits and pieces strewn around) that you don't want to risk
115
+disturbing any of it. Instead, you create a temporary linked worktree to
116
+make the emergency fix, remove it when done, and then resume your earlier
117
+refactoring session.
118
+
119
+------------
120
+$ git branch emergency-fix master
121
+$ git checkout --to ../temp emergency-fix
122
+$ pushd ../temp
123
+# ... hack hack hack ...
124
+$ git commit -a -m 'emergency fix for boss'
125
+$ popd
126
+$ rm -rf ../temp
127
+$ git worktree prune
128
+------------
129
+
130
BUGS
131
----
132
Multiple checkout support for submodules is incomplete. It is NOT