Git-TF push all changes to another TFS repository
Asked Answered
B

1

6

I cloned TFS repo to my local Git and then tried to change TFS remote to another repository to transmit all the changesets to it using the following commands:

git tf --force configure http://tfs2012:8080/tfs/DefaultCollection $/ProjectName

git tf checkin

Afte that a got the following error:

git-tf: TF14019: The changeset 31129 does not exist

What's wrong?

PS: Old repository has a version 2010, and new one is 2012. New repository is empty

Babism answered 23/4, 2013 at 2:58 Comment(0)
E
4

I would be remiss if I were to not mention that git-tf was not meant to be a replacement for a proper migration and integration tool.

That said, if you want to try, you cannot simply git tf clone a repository and then git tf checkin to a different server. git-tf maps commits to changesets to ensure consistency in the git and TFS repositories. Thus when you change the remote, it goes looking for those changesets in the new server.

If you really want to push this to the new server, you'll need to remove the changeset to commit map.

The easiest and most robust way to do this - without messing with the configuration data - is to simply clone the git repository and set the cloned repository up with the new server. Then you can git tf checkin to it:

$ git clone ~/path/to/repo ~/path/to/cloned_repo
Cloning into cloned_repo...
done.
$ cd ~/path/to/cloned_repo
$ git-tf configure https://youraccount.visualstudio.com/DefaultCollection $/YourProject
Configuring repository
$ git-tf checkin 
Connecting to TFS...
Checking in to $/YourProject: 100%, done.                            

Since git-tf maps only a single TFS repository, this also allows you to do incremental moves. If, after the initial migration, there are new changesets you want to migrate, you can pull them to the cloned git repository, then push them to the new TFS server without re-reconfiguring.

$ cd ~/path/to/cloned_repo
$ git pull ~/path/to/repo
$ git-tf checkin
Connecting to TFS...
Checking in to $/YourProject: 100%, done. 
Engagement answered 23/4, 2013 at 3:58 Comment(3)
I also discovered that removing .git/git-tf folder can do the same effectBabism
Today I understood, what you explained. Now it worked for me. Nevertheless this answer could be better, if you add a step by step instruction after explaining the steps in narrative way. I started with this answer, after a couple of days I eventually did the steps the way you desribed it. I had to learn it the hard way.Covalence
@SaschaGottfried Glad it was helpful and I apologize for the confusion. Thank you for the edits, I agree that this is much more useful.Engagement

© 2022 - 2024 — McMap. All rights reserved.