3

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.

riQQ
  • 9,878
  • 7
  • 49
  • 66
m00nbeam360
  • 1,357
  • 2
  • 21
  • 36

1 Answers1

3

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.

Philippe
  • 28,207
  • 6
  • 54
  • 78
  • This is awesome, thanks! 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. – m00nbeam360 May 05 '15 at 18:15
  • 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!!!) – Philippe May 06 '15 at 10:48
  • Perfect, great answer! Luckily, didn't have to go this route, but now I know! :) – m00nbeam360 May 06 '15 at 13:20
  • Makes sense to do it like this. Would be nice to have this as an 'git-tfs add-tfs' command, that basically does what the clone command does except that it doesn't do the git stuff. ;) – Rubenisme Sep 29 '16 at 12:32
  • Regarding a separate GIT repo (repoA) and how to push changes from it to TFS - what I ended up doing was cloning the TFS repo to a GIT repo (repoB) using git-tfs, then merging changes from repoA to repoB (locally) and commiting them from repoB to TFS. The script described here did not work for me. – user1713059 Dec 06 '18 at 10:21