Skip to content

Instantly share code, notes, and snippets.

@ringods
Created December 14, 2014 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ringods/168c2cf7726a536deb9c to your computer and use it in GitHub Desktop.
Save ringods/168c2cf7726a536deb9c to your computer and use it in GitHub Desktop.
Migrating from TFS to Git with converted metadata
# These files are text and should be normalized (convert crlf => lf)
*.cmd text
*.config text
*.Config text
*.cs text diff=csharp
*.csproj text
*.datasource text
*.disco text
*.edmx text
*.map text
*.md text
*.msbuild text
*.ps1 text
*.settings text
*.sln text
*.svcinfo text
*.svcmap text
*.t4properties text
*.tt text
*.txt text
*.vspscc text
*.wsdl text
*.xaml text
*.xsd text
# Images should be treated as binary
# (binary is a macro for -text -diff)
*.ico binary
*.jepg binary
*.jpg binary
*.sdf binary
*.pdf binary
*.png binary
user@host:MyComponent$ git add .gitattributes
user@host:MyComponent$ git commit -m "Central repository configuration"
#!/bin/sh
git filter-branch -f --env-filter '
case ${GIT_COMMITTER_NAME} in
"DOMAIN\joe") name="Joe" ; email="joe@domain.com" ;;
"DOMAIN\foo") name="Foo" ; email="foo@domain.com" ;;
"DOMAIN\baz") name="Baz" ; email="baz@domain.com"
esac
export GIT_AUTHOR_NAME="$name"
export GIT_AUTHOR_EMAIL="$email"
export GIT_COMMITTER_NAME="$name"
export GIT_COMMITTER_EMAIL="$email"
'
user@host:MyComponent$ git rm --cached -r .
user@host:MyComponent$ git reset --hard
user@host:MyComponent$ git add .
user@host:MyComponent$ git commit -m "Introducing normalised line-endings"
user@host:~$ git tf clone --deep --no-tag http://tfs.domain.local:8080/tfs/MyCode $/MyComponent/Development/Development MyComponent
user@host:MyComponent$ git gc --prune=now
user@host:MyComponent$ git remote add origin http://me@gitserver.domain.com/MyComponent.git
user@host:MyComponent$ git push origin master
user@host:~$ cd MyComponent
user@host:MyComponent$ git branch -rd origin_tfs/tfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment