Question : git how to not commit but keep changes
Answered by : mobile-star
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.
Source : https://stackoverflow.com/questions/18073106/on-local-branch-dont-want-to-commit-changes-but-need-to-switch-to-another-bra | Last Update : Wed, 04 May 22