gitgithubtfvcgit-tfs

git-tfs local Git repo to TFVC


I'm testing out git-tfs with an on-premises TFS instance (does it work with VSO, too?) and trying to use rcheckin to push my Git commits up to TFVC. However, when I try and use rcheckin, I get an error that no TFS parents are found. The TFVC repo I'm pushing to is empty, and I want to push my changes from Git to TFVC. Here's what I've done:

C:\git add remote tfs http://localhost:8080/tfs/DefaultCollection/TeamProject
C:\git tfs rcheckin -master
Working with tfs remote: default
No TFS parents found!

What am I missing? Do I run this command for my other branches (like feature1, feature2, etc.)? I'm pretty new to Git-TFS, but it seems like a very handy tool.


Solution

  • Disclaimer : I'm one of the developer of git-tfs...

    does it work with VSO, too?

    Yes!

    What am I missing?

    Before being able to work with git-tfs (and use the rcheckin command), you MUST clone your tfs repository.

    Feel free to read the other docs, too. The use of rcheckin is a good idea ;-)

    How do I use an existing Git repo (separate) to push changes to the TFS repo? I've cloned the TFS repo, and it looks like it goes into a separate folder with it's own .git folder

    Git-tfs is not intended to do that. But a (difficult!) solution exists using rebase.

    1. Add your existing repo as remote in the new repo cloned from TFS and fetch
    2. Use git rebase --into to rebase your old existing commits into the one fetched from tfs
    3. Use rcheckin to push the commits
    4. Do that again and again if you have branches (with more subtilities. I hope you have not!!!)

    edit: I have written a shell script to replace the first 2 steps and make it easier and quicker.