Git allowing me to switch branches without committing changes

后端 未结 5 875
遥遥无期
遥遥无期 2021-02-03 22:40

I am just learning Git, going through a tutorial. I am in branch seo_title and I have uncommitted changes to file mission.html. I did git checkout master expecting

5条回答
  •  名媛妹妹
    2021-02-03 23:18

    Git - the stupid content tracker. It just operates with working tree snapshots. The main requirement - you should be able to reconstruct working tree. It does update of course. But if the modified file is the same in both branches - why not to allow switch? If you done it by mistake, you could switch back reconstructing previous state, no big deal. But if the file is differ in the branches, you need merge content, that's why it insists to commit changes, otherwise it will be impossible to go back.

提交回复
热议问题