-2

I create a new branch dark and add a new file y.js. Then I switch back to the main branch. Why is y.js not lost when I switch branches?

Demonstration video

jonrsharpe
  • 107,083
  • 22
  • 201
  • 376
  • 1
    Because uncommitted changes are not _on_ any branch, they're not part of a commit. – jonrsharpe May 19 '22 at 23:04
  • 1
    https://stackoverflow.com/questions/67450004/git-checkout-branch-after-git-add-seems-not-update-index-and-working-area – matt May 19 '22 at 23:22

0 Answers0