git, jak się nie popełniać, ale zachowaj zmiany

You can use git stash, which will save your changes without creating a commit.1

First, stash your changes:

$ git stash
Then switch to your other branch:

$ git checkout branch-B
When you're ready, go back to your original branch and unstash your changes:

$ git checkout branch-A
$ git stash pop
See the documentation linked above for more details and specifics on additional use cases.

Mobile Star