Teach "git branch" about --new-workdir
commitecd4e40cfd784a93887c9c6aa133226c37bcc7da
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 21 Jul 2008 17:53:24 +0000 (21 18:53 +0100)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Sun, 7 Feb 2010 19:17:09 +0000 (7 20:17 +0100)
tree8ddeb13d1f239f6c4cf67813737365e26e407d65
parent586f59d95e691b2410968d0440b7bb6f5460e849
Teach "git branch" about --new-workdir

Inspired by contrib/workdir/git-new-workdir, the flag --new-workdir (or
its shortcut, -n) can be used to create a new working directory for the
newly created branch.  All information, except which branch is checked
out (and therefore also the index), will be symlinked from the current
repository.

Example:

$ git branch -n ~/my-new-topic xy-problem

will create a branch called "xy-problem", which is initially identical
to the current branch, and check out the new branch in ~/my-new-topic/.
You will be able to cherry-pick from, log and diff with the branch
"xy-problem" in the current repository, since most of the metadata is
shared.

Conversely, you can access all the branches in the current repository
from ~/my-new-topic/, too.

A word of warning: switching to _same_ branch that is checked out in
the other repository is asking for trouble.  You are really working not
only on the same object database, but also the same (i.e. not copied)
refs namespace.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Documentation/git-branch.txt
builtin-branch.c
t/t3200-branch.sh