Why does Git switch my branches when I have modified files in the working folder?

前端 未结 2 657
慢半拍i
慢半拍i 2020-12-22 04:59

I have two branches. I changed some files while on one branch but did not add or commit them. The changes are in my working folder only. The changes are on tracked files but

2条回答
  •  有刺的猬
    2020-12-22 05:46

    You are probably referring to un-tracked files, not changed files. Un-tracked files where never added or committed to any branch, and they stick around when you switch branches.

    If you change a tracked file, git won't let you switch branch until you do something with it (commit, discard the change, etc...).

提交回复
热议问题