Duplicated and multiple time tracking in YouTrack results in wrong spent time
Hello,
we have the issue that the time tracking does not work properly. Time values were considered multiple times and results in wrong “spent time”
Here is our workflow:
- we use git with a main branch and feature/task branches
- when we start a new task we create a new task branch
- we report our spent time via commit comment like “#Issuenumber work 1h comment”
- we have connected teamcity with youtrack via the build server integration
- as long as we simply commit and push only in the task branch, everything is fine. YouTrack shows all commits and corresponding spent time entries of each commit in the issue view and calculates correct resulting spent time
- but if we squash commits, where we write a new commit comment with accumulated spent time, the time tracking breaks. There are old commits and the new squashed commits, that results in wrong final spent time value
- the same occurs if we have to rebase a task branch, the time tracking breaks
- also if we merge the task branch in the main branch, the time tracking breaks
Is there a way to avoid those issues?
Please sign in to leave a comment.
Hi Viktor. Squashed commits are treated as any other commits, so the spent time added in the commit message is added to the previously added spent time. You could try posting only the newly-added work in the squashed commit instead of the accumulated time. With regard to the other cases you've mentioned, I assume that the same situation occurs, so the recommendation would be the same.
Hi Stanislav,
thanks for your reply.
Over the past few months, we’ve tried to find a workaround, but ultimately ended up manually correcting the time tracking in each ticket — which has been quite frustrating.
I understand that YouTrack can't reliably distinguish all commits when we rewrite the commit history of a task branch during squash or rebase. Given that, I believe the best solution for us would be to disable time tracking for our task branches entirely. That way, YouTrack would only consider commits from the main branch when a task is completed and merged.
Unfortunately, I haven’t found a way to disable time tracking for specific branches. Am I missing something here?
We’re currently using YouTrack Build 2024.3.85077.
Best regards,
Viktor
Hi Viktor,
You're right—there is no way to disable time tracking for specific branches out of the box.
What you can do is create a custom workflow rule. Whenever a work item is added to the issue, the rule can automatically check if there is a VCS change attached to the issue with a matching
createdtimestamp. If the timestamps in the attached commit and the work item match, that likely means the work item was added via a command in the VCS comment. In that case, you can further check the branch in that VCS change and if it is found to be the task branch, delete the work item automatically.