I was expecting a error while checking out to master branch from branch b1, as b1 have uncommitted changes. But I don't get any error and rather changes made in b1 are carried to master branch. Can you explain why is that, I know we can use git stash to keep uncommitted changes and switch to branch. But I want to know why git allowed to switch to master branch in the below case, I have already read Git - checkout another branch when there are uncommitted changes on the current branch but can't wrap my head around it
echo "Line 1" > a.txt
git add a.txt
git commit -m "Initial Commit"
git checkout -b b1
echo "Line 2" > a.txt
git checkout master