Specific case:
You're working on a feature but forgot to change branches. This feature is going to corrupt master, it seems, but you haven't committed yet.
alternative to stash,
git branch newbranchname
git checkout newbranchname
git add .
git commit -m "I needed a branch for this before killing master"
if you git checkout master, all these new previously uncommitted changes aren't there (whew) but git checkout newbranchname has the stuff you've been working on.
when you're ready to put them back, just merge back to master.
No comments:
Post a Comment