During our sprint we discovered that we needed to finish some unforseen, but absolutely neccessary tasks to complete.
How do you handle these as best practice ? Should I create this task on the sprint backlog and put the completed hours in it ? Or should I add these extra hours to the task that I initially was working on ?
The tasks that are created for a story during the sprint session are just the beginning . New task will often be identified as part of realizing a story. I typically suggest to add them if they are more than 3 hours. We don't track completed hours typically in a Scrum team, but we do put the effort remaining. This is useful since it updates the Sprint burndown report which we use to track progress toward the sprint. If it is a small task and that it make sense to add the work remaining as part of another task then that works too. I suggest to keep your tasks smaller than 2 days. If a task become bigger than 2 days of effort remaining, you should find ways to decompose it into smaller steps.
Martin Rajotte - Scrum Coach and TFS Expert at Incycle Software