You can use cherry-pick:
Let say you have two branch A and B and mistakenly done a commit in a wrong branch B
Take the commit id you want to add to otherit from the branch by git log. GoB using
git log
Got to the branch byA using
git checkout <branch-name>
git checkout A
Now do cherry-pick using:
git cherry-pick <commit-id>
If you get conflicts resolve it and do checkout <branchgit name>add
and then commit.If you want to add that commit
and do :abort cherry-pick use
git cherry-pick <commit-id>-abort