'<科>'已在'< / other / location>'处签出在git worktrees中 [英] '<Branch>' is already checked out at '</other/location>' in git worktrees

查看:165
本文介绍了'<科>'已在'< / other / location>'处签出在git worktrees中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用git worktrees。它似乎能够工作,但在尝试检出克隆的工作树中的分支时遇到此错误:

 致命: '< branch>'已经在'&b / b / b'我可以在不删除 .git / worktrees 目录吗? Git不会让你两次检查同一个分支,因为如果你这样做,然后去两个工作树中的一个并做一个新的提交,你会回到自己的痛苦中 

如果您实际上已经删除了其他工作树,只需运行 git worktree prune 让Git认识到这一点。如果你有不是实际上删除了另一个工作树,不要检查它两次:这没什么好玩的。


I started using git worktrees. It seems to work, but I'm getting this error when attempting to check out a branch in the cloned worktree:

fatal: '<branch>' is already checked out at '</other/location>'

How do I get around this without deleting the .git/worktrees directory?

解决方案

Git won't let you check out the same branch twice, because if you do, and then go to one of the two work-trees and make a new commit, you'll set yourself up for misery when you go back to the other work-tree.

If you have actually removed the other work-tree, simply run git worktree prune to make Git realize this. If you have not actually removed the other work-tree, don't check it out twice: it's no fun.

这篇关于'&LT;科&GT;'已在'&lt; / other / location&gt;'处签出在git worktrees中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆