Use git with git-tfs for backing up TFVC on Visual

2019-07-27 14:08发布

问题:

We are currently using TFVC in Visual Studio Team Services as Source Control system. The problem is there is no backup possibility where we can keep all changesets locally (company policy). My idea was to use git-tfs, which seems to work fine for fetching changes, meaning i have a local repository. Now I would like to push all changes fetched with git-tfs into another repository git repository.

...> git tfs fetch --all

Working with tfs remote: default => $/XXX/Development
... SOME LINES LIKE: Fetching from TFS remote 'BLABLALBA'... (without changesets)
Fetching from TFS remote 'default'...
C15292 = bee73744bae425be4947772a98b062850e4684f9
C15293 = addccf6a02912a18584ec122744ea23173234dbc
SOME MORE CHANGSETS

...> git push --all origin
Everything up-to-date

P.S.: I am completely new to git so maybe i misunderstood something.

EDIT: To clear it up: We are thinking about to migrate to git. So the push would be to a repository which we want to use for testing (has nothing to do with the backup).

Also I am using Git-Tfs not git-tf.

回答1:

It's really a good way to backup TFVC locally by cloning it to Git repo for now.



回答2:

You have a number of options:

  1. TFS Integration Tools - You can install a local TFS and have the TFVC code from VSTS sync locally on each checkin.
  2. Git-TF - You can clone your TFVC repo to Git locally. However size might be an issue. If you scope to only small projects you will be fine.
  3. Scheduled Build - You can install a local Build agent on your network. The setup a scheduled build on VSTS, using that agent, that pulls the code and stores it somewhere (copy to a network share) using PowerShell.

Consider that #1 is hard to setup and maintain, and #2 will suffer from all sorts of TFVC->Git issues if for properly scoped. #3 is you easiest to setup and minimal maintenance option...