Sharing code between 2 TFSVC repositories with git-tfs - tfs

I have 2 different TFS repositories (one using Visual Studio Online and another using my own local on premise TFS instance) which I want to keep in sync using git-tfs. How do I need to set things up so that I can work locally in git and push changes up to both repositories? Please note both TFS repositories are using TFSVC.

As the main developer of git-tfs, believe me, that's not possible...
Git-tfs can only manage one TFVC repository.

Short answer: Not support.
If you want to sync Visual Studio Online and local TFS. You can use the TFS Integration Tools to setup a unidirectional sync, that should allow you to ensure that a TeamProject on your local TFS system remains in sync. However, they are complicated to setup and will be painfull to run. And There are commercial options that are ridiculously expensive, like OpsHub.

Related

Move code from TFVC on TFS 2010 to TFVC on Azure DevOps Server

I have some projects on TFVC source control on TFS 2010. I want just to migrate the source code from TFS 2010 to TFVC on Azure DevOps Server.
I don't want to process an upgrade of the entire collection to a newest version. I Just want to transfer my code with history.
I tried Git-TFS. I cloned my repository on TFS 2010, but I don't know how I can update the remote URL for TFVC repos and push on Azure DevOps Server.
Any ideas how I can do it? Or other tools that I can use?.
In the case I decide to migrate without history how can I do it?
Thanks.
git-tfs is a two-way bridge between TFS (Team Foundation Server) and git, similar to git-svn. It fetches TFS commits into a git repository, and lets you push your updates back to TFS.
If you want to move code from TFVC on TFS2010 to TFVC on Azure DevOps 2019 and keep history.
You have to do the upgrade process of entire project collection.
In the case I decide to migrate without history how can I do it
You could just create corresponding new team projects and workspaces. Pull down your source code from your TFS2010 workspaces/projects. Copy and paste source code files/folders in new workspace. Then check in them back to Azure DevOps Server 2019.
We advise you keep preview TFVC repository of 2010 online but read-only to view history.
Same with Azure DevOps Service, hope this helps.
Disclaimer: I'm the last maintainer of the git-tfs tool (even if I no more work on it)
Git-tfs could be used to migrate from TFVC to git (with history and branches if your history is not too complex).
But in no way it could be used to push this history to another empty TFVC project.
So don't expect something from here.
Fun fact (not so fun for you) :
To prevent regression developing git-tfs, I created a TFVC project on Codeplex used to run smoke tests in a Continuous Integration job.
When Microsoft decided to close Codeplex, I contacted a guy working in the source control team inside Microsoft to help me migrate from Codeplex to Azure Devops (at the time called VSTS) which is the problem you try to solve.
I don't know if they put a lot of effort into this but no one was able give me a solution. The only thing they think about was to use git-tfs, that I confirm you is not able to do it!
That could give you an idea of the problem you're trying to solve...
Ps: that also show that TFVC is not an enough flexible source control and their is a much higher added value to migrate to git (like nearly everyone is doing it...)

Merge from VisualStudio Online to local TFS and back?

Have an in house TFS server that employees use (using TFVC) and third-party contractors that are using VisualStudio Team Services (aka Visual Studio Online or VSO) (also using TFVC). Need to keep the two synced; projects in VSO get merges from check-ins from TFS and TFS get merges from VSO. The TFS instance has many dozen projects and the VSO instance has two or three of those in TFS.
Any suggestions appreciated.
While there are a few tools that can "sync" between different TFVC instances, it's very hard to keep the flow going and you often run into merge conflicts and other problems. The TFS Integration tools were an official solution from Microsoft, but those have been deprecated.
Given that you're on TFS 2017 and VSTS, I'd highly recommend switching to Git repositories. Git was made to handle scenarios like these, to have multiple hosts that need to share the history and from which you need to be able to sync sources across.
Both TFS 2017 and VSTS can host the repository for you and it's relatively easy to setup CI builds that sync the sources between branches on both instances to trigger pull requests.

How to integrate TFS 2015 and VSTS

We need to synchronize several projects hosted on Visual Studio Team Services with our on-promise TFS 2015 Update 2. The ultimate goal of TFS is to have CI/CD happening within company for all external projects. However, we don't want to interrupt developers for whom using VSTS will be better choice then TFS.
However, I can't find any solution for TFS to use VSTS as a repository, though TFS can use Git. Maybe, I should look differently on this case. Does anyone know any possible solution?
You'll need tools to migrate between on-premise TFS and VSTS, like:
TFS Integration Tools
OpsHub Visual Studio Online Migration Utility
A useful blog for your reference.
I suspect that setting this up is going to be tricky or it's going to cost you.
The free OpsHub migration utility isn't going to help you in this scenario so you're looking at a commercial product like :
TaskTop Sync or OpsHub Integration Manager
but I haven't used them in this scenario so can't comment on either.
TFS Integration tools would probably do the job but you've got some work to do to get them working and it's not pretty. I have them setup at the minute to sync Work Items from TFS 2015 to VSTS for testing purposes and it works okay. My blog on setting them up with VSTS/2015 is here
Would you not consider doing your CI/CD directly from VSTS rather than an on-premise TFS? You could still have the build/release agent running on-prem and you could lock down permissions for your external devs so you control all the build and releases and any other projects.
Git would be a simpler way of merging code between VSTS and TFS2015 but that assumes you are using Git on your 2015 projects and I believe it would be manual process for someone to do this (someone may be able to comment on a way to make this work)

Can I utilize two different versions of TFS to manage source code?

I am not familiar with TFS, however the scenario that I will be coming across is that I will have a branch of source code stored in Visual Studio Team Services (was TFS Online) and locally I will be running TFS 2008.
Would there be any issues pulling the code from Team Services and merging with TFS 2008?
You won't be able to bind the code (solution and projects) to 2 different TFS servers. If you're using the online version of TFS what reason would you have of also trying to store the code in a local repository?
You definitely won't be able to merge the code between the different servers. TFS is a centralized version control system and merge operations need to be handled and tracked by the server.
You could theoretically Manage the code in one of the TFS servers (i.e. have the solution bound to TFS online) and manually manage the code in the other server. However TFS 2008 only supports local workspaces which means that it will make files read only if they are not explicitly checked out. This will cause you no end of pain.
Even if you did it the other way round (made the local TFS server the "master") you will almost certainly create yourself a load of problems as TFS simply isn't designed to be used this way
Also TFS 2008 is pretty ancient and unsupported.
EDIT:
The typical TFS workflow is.
Create a development branch on the server.
"Get" the code to a local folder on your dev machine (called a workspace).
"Check out" the files you need to modify from your branch or "Add" new files as needed.
You should regularly "check in" files to your branch to make sure your changes are saved on the server.
When your changes are complete then "merge" the code from the development branch back to the Main branch.
The code is stored and versioned on the server, but your changes are made on your local machine. To interact with the server you use the Team Explorer plugin in Visual Studio. Modern version of Visual Studio have Team Explorer built in.
If you're using the online version of TFS then you'll want to use Visual Studio 2012 or above.
If you're planning on Forking the code and do not plan on committing your changes back to the server, then you're probably better off using something like Git. You could use Git-tf or Git-TFS to pull changes from TFS and then that would make merging a lot easier and you could use your local Git Repo to manage your own changes

TFS as a local repository for Visual Studio Online

We just started test-running VSO for source control/Scrum management on a new project. We currently use TFS running in-house for other projects. I love the VSO scrum tools, but, with today's VSO outage, we are questioning whether VSO is practical for us as a source control.
After researching this afternoon, I don't see a solution to have a local backup of VSO. My current thought is to use a local git repo that pushes to VSO. The problem with that is switching technologies is not an easy sell, especially when we already have the local TFS to maintain.
We have thought of using VSO to manage scrum tasks and keep source control in-house, but I really don't like having the two separated (can't link commits and I think that everything should be in one place if possible).
Yes, for you purists out there, we do have a big whiteboard with index cards and stickies for our sprint tasks, but we're still looking at the cloud as another option ;)
To condense my rambling into a real question: Is there a way to use in-house TFS as a local repo that pushes to VSO, or to at least have it mirror VSO?
Are you concerned with VSO losing your source (extremely unlikely), or just experiencing the occasional outage and not being able to check in or get latest for a time?
Using git for source control would be the simplest approach, as you've stated. You'll have the full repository on your development machine and can make whatever commits you like. Changing source control would mean upskilling the team on git, creating a new team project and using git-tfs or git-tf to migrate the history, so I understand why you might not want to change.
With TFVC, if you are using a local workspace you should still be able to work during an outage and make changes. You just won't be able to check in. If VSO has an outage it'll be an inconvenience but shouldn't stop you working.
In terms of using TFS as a mirror that pushes automatically to VSO, the simple answer is "No, you can't do that".
If you used git, you could set you local repository to have two remotes, one being the local TFS server and the other being VSO, but it would still be up to you to push/pull the changes manually between both servers yourself to keep them aligned.

Resources