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.
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.
来源:https://stackoverflow.com/questions/11333835/git-tfs-a-tfs-changeset-per-git-commit