Git-Tfs: A TFS changeset per Git Commit?
Asked Answered
L

1

5

At work we use TFS, and I'm trying to get the Git-TFS tool to work so that I have more flexibility when working with local commits before pushing them to our TFS repo.

I have this working, but when I do a git tfs ct, it checks all my commits into one TFS changeset. Am I missing something, or is this how it's supposed to work? If it doesn't push each of my commits individually to TFS as separate changesets, then it seems to defeat the purpose of using git-tfs in the first place.

Laplante answered 4/7, 2012 at 18:17 Comment(0)
S
9

I use the rcheckin command which commits your new git changesets to tfs one at a time, rebasing the remaining commits after each tfs commit to yield a normal looking tree. Using the checkintool subcommand produces a mergecommit - I don't recall it squashing git commits though.

So we use a normal git workflow: checkout a feature branch, work on it, checkout master and 'git tfs pull', rebase the feature branch against master if necessary then merge feature to master and do git tfs rcheckin. Finally, delete the feature branch. On the rare occasions this has failed (due to a locked tfs file) the rcheckin halted leaving everything in a sensible state so that once the obstruction was cleared it was no problem to continue.

All in all, git-tfs makes using TFS bearable.

Sequacious answered 4/7, 2012 at 21:19 Comment(2)
Great! That works just as I wanted. I wonder why the Github readme and wiki pages don't mention that command.Laplante
The only thing I don't like about rcheckin failing from due to a locked file is that your changes are partially sent to the TFS server. Since I work with a team of people who are Git shy and prefer TFS, I am forced to squash my commits with rebase -i so that my success/failure is always atomic.Ribbentrop

© 2022 - 2024 — McMap. All rights reserved.