I have uncommitted local changes. I would like to create a new branch and move the changes there.
Is my understanding correct? I should do:
git diff > my_work.txt
git checkout -b new_branch_name
git push origin new_branch_name
git apply my_work.txt
I have uncommitted local changes. I would like to create a new branch and move the changes there.
Is my understanding correct? I should do:
git diff > my_work.txt
git checkout -b new_branch_name
git push origin new_branch_name
git apply my_work.txt
git stash makes this a little easier.
$ git stash
$ git stash branch new_branch_name
This will preserved both staged and unstaged changes before creating and checking out the new branch.
You can use git stash:
git stash push --include-untracked
git status
git checkout <MyFancyBranch>
git stash pop