Abdullah
Abdullah

Reputation: 175

Migrate/Copy existing Local Git Repo. to TFS (Visual Studio)

So I have this simple requirement. I have kept a project maintained on local Git Repo. and all my work with History is maintained on there. We also have a Team Foundation Server where multiple projects are setup. I wish to transfer/copy/migrate my Git project along with all the Git history to a project I have created on TFS. I will no longer use Git local after this and continue TFS for further development.

A number of solutions are available which is confusing me and I wish to do it through Visual Studio (if possible) that will not mess up the history/tracks I have maintained on Git local.

My VS version:
VS

Local Git:
Local-Git

Branches (master):
Branches

History:
History

TFS:
TFS-1

TFS-2

Upvotes: 3

Views: 4575

Answers (2)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51183

If you want to do this through Visual Studio, you need first Connect a local repo to a remote

To connect a local repository to a hosted remote Git repository(TFS remote git repo) to share your work, go the Settings page in Team Explorer. Select Repository Settings. Under Remotes, select Add.

enter image description here

Enter origin in the Name field and enter the clone URL for your repo in the Fetch field. Make sure that Push matches fetch is checked and select Save.

After this you just need simply pull and push or just select the sync command in Visual Studio. TFS will auto sync your local git repo's history.

If you want to review your history of that repo, you could take a look at this tutorial.

Upvotes: 2

Daniel Mann
Daniel Mann

Reputation: 59065

There's nothing special you have to do here; TFS Git is the same as regular Git, and all the same commands work the same way.

  • Add a remote to your local repo with git remote add upstream [url-to-tfs-repo]
  • Push your changes to the remote with git push upstream --all

Upvotes: 1

Related Questions