Check out example codes for "how to save updated commits to another branch". It will help you in understanding the concepts better.

Code Example 1

git stash
git checkout other-branch
git stash pop

Learn ReactJs, React Native from akashmittal.com