Skip to content

Commit 9645459

Browse files
sunshinecogitster
authored andcommitted
Documentation/git-worktree: add EXAMPLES section
Signed-off-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a8ba5dd commit 9645459

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Documentation/git-worktree.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,28 @@ to `/path/main/.git/worktrees/test-next` then a file named
105105
`test-next` entry from being pruned. See
106106
linkgit:gitrepository-layout[5] for details.
107107

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+
108130
BUGS
109131
----
110132
Multiple checkout support for submodules is incomplete. It is NOT

0 commit comments

Comments
 (0)