If you have uncommitted changes (or new files added) in your working tree and you want to switch to a new branch, those uncommitted changes will also carry to the new branch. Changes that you commit will be committed to the new branch.
However, if Git finds a conflict between the uncommitted changes in your current branch and the files in the new branch you’re switching to, you will not be allowed to switch. You must commit or stash those changes before switching branches.
You can think of
stash as a drawer for temporarily storing uncommitted changes. Stashing allows you to put aside any “messy” changes in your working tree and continue working on a new branch with a clean slate.
You can always take out uncommitted changes stored in the stash and apply them to the original branch and other branches later.