Say you've added a few files to a commit and you decide later to move it to a different branch. You need a couple of git commands:
First. You need to split the commit into multiple commits which done via an interactive rebase:
git rebase -i HEAD~n
(the number of commits you want to go backgit rebase --onto