Re: [PATCH 3/3] Teach "git branch" about --new-workdir
- From
Julian Phillips <julian@quantumfyre.co.uk>
- Date
- Jul 22, 2007, 21:09 UTC
- Message-ID
- <Pine.LNX.4.64.0707222205050.23426@reaper.quantumfyre.co.uk>
- In-Reply-To
- <Pine.LNX.4.64.0707221956210.14781@racer.site>
On Sun, 22 Jul 2007, Johannes Schindelin wrote:
Show 30 quoted lines
> > 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> > --- > IMHO this is a better syntax than what is in contrib/, and "git > branch" is probably the right place for such a thing, from a > user's perspective.
Surely checkout would make more sense than branch? You are effectively checking out into a new directory ... also you may want to get an existing branch (certainly most of my usage of new-workdir is checking out existing branches, e.g. to look at - as in build and play with - an interesting branch that someone else has pushed out).
Definitely in favour of moving this into git proper though.
-- Julian --- Lack of capability is usually disguised by lack of interest.