Are git stash
and git stash pop
a good solution for this problem?
I was working on branch B, but something happened accidentally and unbeknownst to me, put me back into an older branch, branch A, where I kept working on various tasks.
Git wants me to commit my new work to branch A, before I can switch over to branch B, but I can't (shouldn't) do that.
Is it safe (meaning will I not lose all my work, but be able to put it over into its correct branch) to, while on branch A (the wrong branch), do git stash
, then switch to branch B (correct branch) and do git stash pop
? Will I encounter any disasters by doing that?
I am unsure of how not to blow up my Git project!