Today we have all our source code on our local TFS server. Now we want that some external parties can access a portion of the code. We therefore looking at the possibility that e.g. Clone this code to an external GIT server they can access.
I have looked at the git-tfs. But if I understand correctly, you have to manually synchronize GIT and TFS when it happened changes on any of them. Is there a way to have a clone of the code that is automatically synced.
If there are changes in TFS, it is automatically synced to GIT, and vice versa. There should be no uncertainty if I work with the most current code
Git in Visual Studio, Azure DevOps Services, and TFS is standard Git. You can use Visual Studio with third-party Git services, and you can also use third-party Git clients with TFS. To learn more, see Git and Azure Repos.
The synchronization engine performs three types of synchronization. This process captures and updates task-related and resource-related data in both TFS and Project Server while respecting the ownership of data by the project manager in the project plan.
Git in TFS is just another git server, it has pretty much all features that the standard Git has. The ability to rewrite history before merging allows you to remove or combine a number of smaller change sets, so that the history is cleaner and easier to read as a human.
There is no way to sync 2 repositories evolving separatly 100% automaticaly with whatever solution you choose (to achieve automatic sync, you must either achieve a sync in no time or being able to block push in git or check in in TFVC when one of the 2 team begin a sync) .
So, you will always have conflicts that you should merge manualy. You could find a workflow that will prevent most of them but never solve all the cases and these remaining cases will be really difficult to solve...
Anyway, you could nearly achived what you want (it depends of your expectations : do you need branching support --hard--,...) with git-tfs (I have included in git-tfs all needed to do that but never used in production) but it's a little bit tricky.
You need to clone your TFS repository in a bare
repository :
git tfs clone https://server/tfs/TeamCollection $/project/trunk --bare --with-branches
then you need to write in your post-receive
hook of this bare
repository something like that (I do not remember if it works) :
branch=$(git rev-parse --symbolic --abbrev-ref $1)
if [ "master" == "$branch" ]; then
branch="default"
fi
git tfs rcheckin --bare -i $branch
With that, every time someone push in the git repository, the commits will be checked in in TFS.
For more comfort (otherwise they will always have boring conflicts to solve when they try to push), you could sync git repository with TFS server with a scheduled task with the command (this way they will be aware of new commits sooner) :
git tfs fetch --all
Note : I don't remember if this command could be used in a bare
repository (now that I think about that, I don't think so). Otherwise you will have to use instead git tfs fetch -b=myGitBranch -i tfsRemote
for each existing branch :(
But I'm sure they will never be able to work with branches that was not already created in tfs :( The git-tfs tool is indeed not able to create automatically a TFVC branch from a git history. Technically, that's achievable, I think, but never developed (because git-tfs is more à tool to run away of TFVC than a tool to check your development in it... )
And some other stuff could be difficult or impossible to do...
I hope it will help.
PS :
The main change since that question was asked (in Q4 2013) is that TFS 2015/2017 now has an official support for Git repositories. See "Git and TFS".
So a reasonable approach would be to:
That will leave you with a collection of TFS projects, each one can be opened to a particular team, ensuring that only specific parts are visible/accessible to other contributors.
And at any time; from the main coderepo repo, you can update those submodules with:
git submodule update --recursive --remote --rebase
(and then test, add, commit and push: your main Git repo will reference the latest developments from those submodules)
Plus, considering l--''''''---------''''''''''''
's previous question, that would help with a single repo with too many files.
Although, for that, there will be soon(ish) GVFS.
The alternative approach mentioned by l--''''''---------''''''''''''
is:
I personally want to be able to use GIT for my own changes, I would have multiple changesets in GIT, then I would merge them into one, and then convert that changeset into a traditional TFS changeset and check that in, that way I just have 1 check-in per TFS item
That is possible, provided you don't mind losing the intermediate Git commit history, when you will agregate them into one TFS changeset.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With