Question

I have an existing git repo that I am being forced to put in tfs. I would like to use the git-tfs tool, but can't figure out for the life of me how to do this. All of the examples I have seen start with git tfs clone, but I already have a git repo and would like to run "checkin" on it.

EDIT: I have tried cobbling together instructions based on the opposite scenario that I need. I have tried creating an empty project and adding that to tfs, then copy my code from git, but I lose my history (which I don't want). What I am looking for here is a set of steps to accomplish what I need.

Was it helpful?

Solution

In fact, git-tfs works only by cloning a TFS repository.

I just hope that you've not a lot of branches to checkin into TFS otherwise it will be long an boring but doable!

First, create an empty repository in tfs.

old solution (still valid if you want to take this way...): and clone it with tfs. You should be able to do it that easily and should have only one commit with no files in this new git repository.

Now, add a remote toward your existing git repository and rebase the remote master onto the initial commit of the new repository.

new solution: Use this script

Then use 'git tfs rcheckin' to commit all the history. It should be very long :(

After that, if you have branches that you want to commit, and if you have the last version of git-tfs 0.17.1, extract the good revision and create a tfs branch with the command :

git tfs branch Name_of_my_branch

and rebase all the commits of the git branch and use rcheckin with : git tfs rcheckin -i Name_of_my_branch

Do that for all your branches and that should be good...

But I should add that if you've got merge commit, they will all be lost in the process :( You won't have a as beautiful repository than you're existing git repository

PS :

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top