Git has a useful feature. You can stash not committed changes and then re-apply them. It helps you to restore the working directory and the index, to a clean working directory as it was before your not commited changes.
To stash your changes run a command below:
# git stash
To apply (unstash) your changes run a command below:
# git stash apply
To view list of stashes run a following command:
# git stash list
Read more about git stash on a documentation page.