Git doesn’t allow me to execute
git worktree add -B <branch> <path> <start-point>
where <branch> already exists in the repository.
The command prints the following:
Preparing <path> (identifier <branch>)
fatal: Refusing to point HEAD outside of refs/
I’m trying to create a worktree on an existing branch <branch>, which should
point to <start-point>. This obviously should fail with “-b”, but I use “-B”
and expect it to be reset to <start-point> as mentioned in the docs:
By default, -b refuses to create a new branch if it already exists.
-B overrides this safeguard, resetting <new-branch> to <branch>.
Do I miss something or there is a bug?
Steps to reproduce:
git init wt
cd wt
echo 'asd' > a.txt ; git add a.txt ; git commit -m initial
git branch br1
git worktree add -B br1 ~/temp/br1 master
Error message:
Preparing /Users/loki/temp/br1 (identifier br1)
fatal: Refusing to point HEAD outside of refs/
Thanks a lot!
-- Kirill--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html