Search code examples
gitgit-stash

How to stash current changes and apply it to a new branch


I'm currently working on a project git is used as the version control. I'm currently in the 0.27.0.i1 branch. And I have some changes which have not still committed to the master branch. These changes has to be committed to the new 0.27.0.i2 branch which originated from the 0.27.0.i1.

How can I stash changes from the 0.27.0.i1 and apply the stashed changes on the 0.27.0.i2 branch.


Solution

  • Just do

    git stash
    git checkout 0.27.0.i2
    git stash pop
    git commit -a