If you have a branch with the #task_id, tracking your commits. Then later once you merge your branch into master, all the commits that occurred on master since you branched off master are also included in the git commits summary for that task.
Shouldn't it only include the tasks that were performed on the #task_id branch and not commits that appeared on the master branch?
Rabasing is also an issue. Tracking a branch with the #task_id and using a rebase strategy means that all commits from another branch are written on top of your #task_id branch. Those commits aren't related to the #task_id, and therefore shouldn't appear in the task git-commit summary.