aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/git-worktree.txt
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2015-07-06 13:30:44 -0400
committerJunio C Hamano <gitster@pobox.com>2015-07-06 11:07:44 -0700
commit96454597562dade701fbfee19891482a97456138 (patch)
tree5f70ce2561677fb2eb241fd44e44bf43c6ce49f4 /Documentation/git-worktree.txt
parenta8ba5dd7b18ed3a3276ee23ab66569dbddc50913 (diff)
downloadgit-96454597562dade701fbfee19891482a97456138.tar.gz
Documentation/git-worktree: add EXAMPLES section
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-worktree.txt')
-rw-r--r--Documentation/git-worktree.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt
index 0385e9a6db..6afff1ed0c 100644
--- a/Documentation/git-worktree.txt
+++ b/Documentation/git-worktree.txt
@@ -105,6 +105,28 @@ to `/path/main/.git/worktrees/test-next` then a file named
`test-next` entry from being pruned. See
linkgit:gitrepository-layout[5] for details.
+EXAMPLES
+--------
+You are in the middle of a refactoring session and your boss comes in and
+demands that you fix something immediately. You might typically use
+linkgit:git-stash[1] to store your changes away temporarily, however, your
+worktree is in such a state of disarray (with new, moved, and removed files,
+and other bits and pieces strewn around) that you don't want to risk
+disturbing any of it. Instead, you create a temporary linked worktree to
+make the emergency fix, remove it when done, and then resume your earlier
+refactoring session.
+
+------------
+$ git branch emergency-fix master
+$ git checkout --to ../temp emergency-fix
+$ pushd ../temp
+# ... hack hack hack ...
+$ git commit -a -m 'emergency fix for boss'
+$ popd
+$ rm -rf ../temp
+$ git worktree prune
+------------
+
BUGS
----
Multiple checkout support for submodules is incomplete. It is NOT