[英]TFS to Git migration with git-tfs: how to completely disconnect Git from TFS after migration?
I successfully cloned a TFS repository, but git log
still shows HEAD pointing to both master and tfs/default as follows:我成功克隆了一个 TFS 存储库,但
git log
仍然显示 HEAD 指向 master 和 tfs/default,如下所示:
(HEAD -> master, tfs/default)
I already tried the filter-branch command, as well as remove the [tfs]
, [git-tfs]
sections from config
file and run the following commands:我已经尝试了 filter-branch 命令,以及从
config
文件中删除[tfs]
、 [git-tfs]
部分并运行以下命令:
git reflog expire --all
git gc --aggressive --prune
git tfs cleanup
git tfs cleanup-workspace
But it's still there.但它仍然存在。 The only thing that works is deleting the
.git
folder then running git init
but of course this loses all history.唯一有效的方法是删除
.git
文件夹,然后运行git init
但当然这会丢失所有历史记录。 I also checked git config --list --show-all
but there is no remote TFS repository in there.我还检查了
git config --list --show-all
但那里没有远程 TFS 存储库。
Question问题
Is it possible to completely disconnect TFS from the git repo without losing history after using git-tfs and if yes, how?是否可以在使用 git-tfs 后完全断开 TFS 与 git 存储库的连接而不会丢失历史记录,如果可以,如何?
EDIT编辑
The accepted answer works and is instructive but see this answer on SuperUser for what I understand is a 'safer' way to do this.接受的答案有效且具有指导意义,但请在 SuperUser 上查看此答案,因为我理解这是一种“更安全”的方法。
Is it possible to completely disconnect TFS from the git repo without losing history after using git-tfs
是否可以在使用 git-tfs 后从 git 存储库中完全断开 TFS 而不会丢失历史记录
Your git repo is not "connected" to the TFS server.您的 git 存储库未“连接”到 TFS 服务器。 It just contains some data the allow git-tfs to be able to interact with the TFVC source control.
它只包含一些允许 git-tfs 能够与 TFVC 源代码控制交互的数据。
What you see tfs/default
is a pseudo git remote branch to keep track of the last changeset retrieved.您看到的
tfs/default
是一个伪 git 远程分支,用于跟踪检索到的最后一个变更集。
and if yes, how?
如果是,如何?
As it is stored as a git remote, the easier is to delete the file:由于它存储为 git 遥控器,因此更容易删除该文件:
.git/refs/remotes/tfs/default
Note: if you can't find this file, this is because there is a possibility that the ref is packed in the file .git/packed-refs
.注意:如果找不到这个文件,这是因为 ref 有可能被打包在文件
.git/packed-refs
中。 If there, delete the line corresponding to refs/remotes/tfs/default
如果有,删除
refs/remotes/tfs/default
对应的行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.