After creating a new repository using git initand performing the first commit (in the branch master)
Then I tried to edit some files while working directory has not yet been cleared, I could do git checkout -b dev , and then git add ., git commit(in the dev branch) all successfully.
But at this time, after editing the files in the dev branch, while the working directory has not yet been emptied, I can’t do it git checkout master , git asks me to sew up or otherwise complete the commit before moving on to other branches.
I am so curious why git acts differently in this case.
Edit (add screenshot)

source
share