This is the mail archive of the
mailing list for the GCC project.
On 1/13/20 6:33 AM, Jonathan Wakely wrote:
I imagine a lot of people are going to feel lost in the first few
weeks of using Git.
thanks. I have a question, but first some info that may well be useful
Today I learnt that one can use worktrees to work with different checked
out branches, but sharing a local repo.
In your checked out original clone do
git worktree add ../some-other-dir branch-to-checkout
then ../some-other-dir contains a checked out branch, tracking the
upstream branch you named.
Jonathan tells me that if you 'git fetch' from any of those checkouts,
the underlying local repo gets updated, and you can git merge them as
Notice this example doesn't show /all/ the exiting things worktree add
can do -- like renaming branches. That just confuses a newbie like me.
Hackers, remember you learned about cardinals (and just called them
numbers) before you discovered zero, and negative integers.
Onto my question. I'm used to having a bunch of sibling directories,
called trunk, pr12345, pr84241, feature-x, all with checked out trunks.
I can't do that with worktrees, because:
> git worktree add ../../using-enum/src master
fatal: 'master' is already checked out at '/data/users/nathans/trunk/src'
If I drop 'master' from the command I get:
>git worktree add ../../error/src
Preparing ../../error/src (identifier src1)
* what does 'identifier src1' mean, and what did that do?
* should I be using user branches for this?
* is it possible do that all in one command?
> git COMMAND ../../error/src SOMETHING
... now ../../error/src has a checked out /users/nathan/error branch
created from master?