I think you're looking for the stash
family of git commands
https://git-scm.com/docs/git-stash
It allows you to store changes without committing them, switch to other branches, and the "pop" the stash when you return.
Here's some basic examples of it's use
http://gitready.com/beginner/2009/01/10/stashing-your-changes.html
From that page
Add your changes to the index using
git add .
Or add individual files to the index, your pick. Stash your changes away with:
git stash
And boom! You’re back to your original working state. Got that bug fixed? Bring your work back with:
git stash apply
You can also do multiple layers of stashes, so make sure to use
git stash list
To check out all of your current ones. If you need to apply a stash from deeper in the stack, that’s easy too. Here’s how to apply the second stash you’ve got:
git stash apply stash@{1}
You can also easily apply the top stash on the stack by using:
git stash pop
A note with this command, it deletes that stash for good, while apply does not. You can manually delete stashes with:
git stash drop <id>
Or delete all of the stored stashes with:
git stash clear