user1522446
user1522446

Reputation: 296

git-tfs clone and cleanup

I have cloned my TFVC from VSTS and it pulled all my branches without any errors. I then followed a number of online posts that said to cleanup my projects by doing the following:

  1. Remove the GlobalSection(TeamFundationVersionControl) section from solution files
  2. remove all *.vssscc files
  3. Remove all *.vspscc files

When I do this I get almost all of my files showing up in the Changes window under Team Explorer. All of these files have no changes when doing a diff except for the files discussed earlier.

What is the proper way to cleanup branches after doing the clone from TFVC to git?

Thanks

Upvotes: 2

Views: 2150

Answers (2)

Philippe
Philippe

Reputation: 31147

When I do this I get almost all of my files showing up in the Changes window under Team Explorer. All of these files have no changes when doing a diff

That should be due to a bad end of line setting...

except for the files discussed earlier.

First commit them...

Then fix your setting.

You've got 2 options (not mutualy exclusive, you could do the 2. But if you do only one, do the 2nd) :

  • (old style), set the git core.autocrlf setting. On windows, that's either true to convert all file to a windows eol style or false to tell git to not touch the files. It's a matter of choice. This settings will be used for ALL your repositories but will be personal
  • (new one recommended) Add a .gitattributes files to telle git how to handle eol for all type of files. This settings will be used for this repository only but will be shared by all the developpers and noone won't be able to commit bad files.

Be aware that for all the strategies that you will try, to be sure that it works, you will have to do soemthing special. You will have to wipe all the files and checkout them all from the repository (because that's at this special moment that git modify the files):

git checkout .

There is a possibility that in fact, the files are modified because they have been checkouted in the format you wish, so commmit them all (you will be obliged) and apply the eol strategy, just after...

A good doc on the subject that you should read carefully and understand before trying something...

PS: handling end of line is not an easy task in a git repository and it will take you quite some time and you will have to try a lot of things before really understanding how it works ( I'm not pretty sure myself ;) )

Upvotes: 0

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31043

If you want to migrate an existing TFVC repos to Git repos, you can use the git-tfs tool, which allows you to migrate a TFVC repo to a Git repo in just a couple of commands.

In my example, with the commands below, I have successfully migrated an existing TFVC repo to Git repo with all branches.

enter image description here

enter image description here

If you don't want to clone the branches, you can specify --branches=VALUE (VALUE=none|auto|all), check https://github.com/git-tfs/git-tfs/blob/master/doc/commands/clone.md

Upvotes: 2

Related Questions