So first check the following image, I tried to represent what I need

The green squares are the commits, and the yellow, brown and red are parts of those commits (in my case commits to specifically 3 files spread through the commits).
There are no further changes made on dev
What actually happened: I was working on a branch and found out that some changes were actually useful on the dev branch and were not actually related to the dev2 branch. So I wanted that those changes on the dev branch.
git checkout
git merge
I actually want the modifications to get out of the dev2 branch and go into the dev branch, so if I do the checkout>commit the modifications will be on both branches, that's why I wouldn't like to do it.
Is this even possible? How can I do it?
 
     
     
    