gittfsgit-tfs

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:

(HEAD -> master, tfs/default)

I already tried the filter-branch command, as well as remove the [tfs], [git-tfs] sections from configfile and run the following commands:

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. I also checked git config --list --show-all but there is no remote TFS repository in there.

Question
Is it possible to completely disconnect TFS from the git repo without losing history after using git-tfs and if yes, how?


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.


Solution

  • Is it possible to completely disconnect TFS from the git repo without losing history after using git-tfs

    Your git repo is not "connected" to the TFS server. It just contains some data the allow git-tfs to be able to interact with the TFVC source control.

    What you see tfs/default is a pseudo git remote branch to keep track of the last changeset retrieved.

    and if yes, how?

    As it is stored as a git remote, the easier is to delete the file:

    .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. If there, delete the line corresponding to refs/remotes/tfs/default