Could not verify branch even after removing worktree and running worktree prune

I create a worktree for the branch using the following command:

Git add worktree <path> <branch-name> 

This created a new working line for me and checked the branch in the path

Now I thought about deleting / deleting the working line. Run the following commands:

 rm -rf <path> git worktree prune 

This should ideally remove the working line and remove the link for this path. So now I should be able to check the branch. But when I run the following command to check this branch:

 git checkout <branch-name> 

I get this error:

 fatal: '<branch-name>' is already checked out at '' 

Can someone help me with what is happening.

+45
git github
Oct 23 '15 at 6:35
source share
4 answers

I worked on this by removing .git/worktrees/<branch-name> from the repository directory.

+46
Oct 26 '15 at 18:27
source share
โ€” -

I think the correct command is: git worktree prune

+9
Mar 28 '17 at 7:55
source share

For me, git worktree add -f... doesn't work, but git worktree add -B... did.

0
04 Dec '18 at 16:21
source share

A quick fix can be if all the relevant branches and code are on github . Remove the full git project directory.

And then clone it again from github by running git clone <github-project>

TIP How to just tip the remote git branch to speed things up

-5
Oct 23 '15 at 7:45
source share



All Articles