似乎每当我在一个分支上更改了一些文件,然后想要更改到另一个分支来做一些不同的工作时,这些更改仍然伴随着我。例如,
$ git status
# On branch master
nothing to commit (working directory clean)
~/Sites/sc, kamilski81 (master)
$ touch FakeFile
~/Sites/sc, kamilski81 (master)
$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# FakeFile
nothing added to commit but untracked files present (use "git add" to track)
~/Sites/sc, kamilski81 (master)
$ git checkout prod
Switched to branch 'prod'
~/Sites/sc, kamilski81 (prod)
$ git status
# On branch prod
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# FakeFile
nothing added to commit but untracked files present (use "git add" to track)
在这种情况下,为什么当我结帐时 FakeFile 会出现在我身边?如何在多个分支上编辑多个文件而无需签入?还是我只是完全错误地这样做?