I am currently on a debug branch, and would like to switch to the master branch, without modifying the working tree (leave it the way it is in the debug branch), so I can co
Here is a raw workflow
git stash
git checkout otherbranch
git stash apply
git reset
git add # interactively? just add the hunks/changes you want to commit
git commit
And to go back
git reset --hard # watch it here! make sure you haven't added more changes that you wanted to keep
git checkout debug
git stash pop
Alternatively, you might just commit the relevant changes 'here' and push / cherry-pick onto the master branch.