有两个分支master
and dist
,都有/node_modules
in 的入口.gitignore
。
在两个分支中都没有未提交/未跟踪的文件,当我在 master 上时,如果我git checkout dist
再次这样做git checkout master
,我看到一些文件夹消失了,但不是全部
这是带有命令的流程:
~/p/retwisn git:master ❯❯❯ git status
# On branch master
nothing to commit, working directory clean
~/p/retwisn git:master ❯❯❯ tree node_modules -L 1
node_modules
├── connect-flash
├── connect-redis
├── express
├── grunt
├── grunt-coffeelint
├── grunt-concurrent
├── grunt-contrib-clean
├── grunt-contrib-coffee
├── grunt-contrib-copy
├── grunt-contrib-watch
├── grunt-mocha-cli
├── grunt-nodemon
├── grunt-shell
├── jade
├── mocha
├── redis
├── redis-url
├── should
├── sinon
├── swagger-node-express
└── yaml-config
~/p/retwisn git:master ❯❯❯ git checkout dist
~/p/retwisn git:dist ❯❯❯ git status
# On branch dist
nothing to commit, working directory clean
~/p/retwisn git:dist ❯❯❯ tree node_modules -L 1
node_modules
├── connect-flash
├── connect-redis
├── express
├── grunt
├── grunt-coffeelint
├── grunt-concurrent
├── grunt-contrib-clean
├── grunt-contrib-coffee
├── grunt-contrib-copy
├── grunt-contrib-watch
├── grunt-mocha-cli
├── grunt-nodemon
├── grunt-shell
├── jade
├── mocha
├── redis
├── redis-url
├── should
├── sinon
├── swagger-node-express
└── yaml-config
~/p/retwisn git:dist ❯❯❯ git checkout master
~/p/retwisn git:master ❯❯❯ git status
# On branch master
nothing to commit, working directory clean
~/p/retwisn git:master ❯❯❯ tree node_modules -L 1
node_modules
├── grunt-contrib-clean
├── grunt-nodemon
└── swagger-node-express
尽管 /node_modules 被忽略了,但不知何故,当切换回 master 时,一些子文件夹被删除了。