Sometimes it happens that I make some changes in my working directory and I realize that these changes should be committed in a branch different to the current one. This usually happens when I want to try out new things or do some testing and I forget to create a new branch beforehand, but I don't want to commit dirty code to the master branch.
So, how can I make that uncommitted changes (or changes stored in the index) be committed to a different branch than the current one?