3

I've tried figuring this out but with no success so far. I am using git-tfs to check in my changes to TFS (local using GIT repository)

I read this question which briefly describes that you can associate workitems in a commit message using metadata ( TF26198 error when doing git tfs rcheckin ) . Commands I've tried using:

1)

git tfs checkin -m "Changes to workitem #12345" => doesn't associate changeset to TFS workitem

2)

git tfs rcheckin -w12345 -m "Changes to workitem 12345" => triggers error "error: This syntax with one parameter is only allowed in bare repository." 

3)

git tfs checkin -w12345 -m "Changes to workitem 12345" => triggers error No TFS parents found

4)

git tfs checkin -m "Changes to workitem #12345" => doesn't associate work item

Any ideas on what I'm doing wrong?

Thanks, Iulia

Community
  • 1
  • 1
julia
  • 452
  • 6
  • 15

2 Answers2

4

Try adding :a behind -w12345 like this:

git tfs rcheckin -w12345:a -m "Changes to workitem 12345"

or

git tfs checkin -w12345:a -m "Changes to workitem 12345"

You can also use :r instead of :a to "resolve" instead of "associate"

I think it's supposed to default to :a if you don't specify a value, but that never worked for me.

Anders
  • 544
  • 2
  • 8
  • This works perfectly, thank you ! I just did a check in and it correctly applied the changeset to the TFS workitem. – julia Jun 03 '14 at 14:26
1

First you should be aware of the difference between checkin and rcheckin (See git-tfs documentation for the commands for that ... It will really help!)

Then commit message are analysed to find workitems assocation only with rcheckin ( and not checkin) so 1) and 4) won't work.

2) The message is strange but that's because rcheckin is not supposed to work that way.

3) Just discovered today (what a coincidence!) that there is a bug in this synthax (that I never use!). Just use :

git tfs checkin -w12345: -m "Changes to workitem 12345"

or git tfs checkin -w12345:a -m "Changes to workitem 12345"

to pass through the bug...

But the error you get tell me that you have a bigger problem (not linked to workitem association) and that you missed something with git-tfs (but I don't see what :( )

For your information, I HIGHLY prefer using rcheckin than checkin command that produce a awfull history with a lot of merge.

rcheckin is simpler. Do all your git commit with associating workitems in your commit message using #12345 and when you are happy, fetch from tfs, rebase your work (or do a git tfs pull -r) and do :

git tfs rcheckin

All should be ok!

Also look at our use cases

Philippe
  • 28,207
  • 6
  • 54
  • 78
  • Another great answer, I've been looking through the documentation a lot and did not figure it out, but you guys cleared it up for me. Had no idea about the syntax issue, thanks for pointing that, as well as the other comments. Have a nice day! – julia Jun 03 '14 at 14:38