I'm trying to create a new worktree, but for an orphan branch. But I
can't find a way of doing this convieniently.

I can checkout a new orphan branch:

git checkout --orphan my-new-branch

That works, but now I can't make a worktree because, I presume there are
no commits yet.

fatal: invalid reference: another-new-branch

More over, it leaves any files on master in place. But, okay, I think, I
can move back to master.

git checkout master
git worktree add ../my-new-branch my-new-branch

But this fails for the same reason.

git worktree  add ../my-new-branch my-new-branch
fatal: invalid reference: my-new-branch

So, the only solution is

git checkout --orphan my-new-branch

git commit (something)

git checkout master
git worktree add ../my-new-branch my-new-branch

All of which seems pretty painful.

Am I missing something?

Phil

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to