Created
December 12, 2014 09:44
-
-
Save jpettersson/4a719e12a03cdfc91ef1 to your computer and use it in GitHub Desktop.
Git: Apply changes from branch as unstaged changes on other branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sometimes that "quick" refactor takes longer than I was planning for. Then it's nice to commit changes to a temporary "dirty" feature branch just to have an off-laptop backup and change history. I use this method for storing a bunch of trash commits on a feature branch and then lifting them back over to master when I want to continue work / clean up. | |
# Check out the branch you want to start working from | |
git checkout master | |
# Check out the dirty "refactor" branch as staged changes | |
git checkout refactor -- . | |
# Reset will unstage the changes | |
git reset | |
Time to clean up! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a handy workflow tip. Is it possible to get similar behaviour with submodules?