Suppose you are in Master branch and you are working with some files[index.html and app.css] and you create a new branch purple and you are changing the backround colours in app.css. suddenly if you want to switch to master branch :
- you can do and all your changes will come to the destination branch. but still they are not commited in the other branch. Once you add and commit and now move to master branch the other branch changes will not be reflected in the main branch.
- Git won’t let me switch if it detects potential conflicts. This is where you can use stashing.