Move A File From One Branch To Another

January 15, 2022

Sometimes I need to move a file from one branch to another here is how to do that.

git add .
git status
git stash
git checkout <branch>
git pop

git add .

Will add the file to git.

git status

Just checks to make sure you can see your changes.

git stash

Will send the file to your stash to move it where you need it.

git checkout <branch>

Will checkout the branch that you want to put the file in.

git pop

Will put the file into the current branch you are working with.

You then commit the file as normal.


Profile picture

Written by Matthew Therault who lives and works in the midwest building insurance things.