I'm on the feature-x
branch doing some work when I suddenly encounter a problem that really needs to be resolved on another branch, hotfix
.
I want to create a commit with this change, but in the hotfix
branches.
From this question I understand that the standard procedure will be
This would work if there werenβt already a lot of changes in the feature-x
branch, which would cause a conflict with the hotfix
branch. I want to avoid the need to resolve unnecessary conflicts.
To avoid this, I thought that I can only extract one file from stash, as indicated in this answer . Thus, the procedure will be as follows:
# On branch feature-x git stash git checkout hotfix git checkout stash@ {0} -- <src/buggyfile.xxx> git add -A git commit -m "Fixed issue #562"
And then I have to go back to feature-x
git checkout feature-x git stash pop
While there is a way to directly output files from another branch, I want to know if there is a way to send files to another branch, without any of this hassle. The actual modification is just a couple of characters.
source share