Skip to content

Commit

Permalink
Documentation/git-worktree: add EXAMPLES section
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Sunshine <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
sunshineco authored and gitster committed Jul 6, 2015
1 parent a8ba5dd commit 9645459
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Documentation/git-worktree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9645459

Please sign in to comment.