Cannot update paths and switch to branch at the same time

git checkout -b 操作出现fatal: git checkout: updating paths is incompatible with switching branches. Did you intend to checkout 'origin/dev' which can not be resolved as commit?
--shell-*git remote show origin

git remote update

git fetch

git checkout -b local-name origin/remote-name

或者

git stash
commit

提交或者暂存修改

git fetch origin

重新下载仓库对象和引用


git fetch origin branch

有选择的下载


例如:

指定远程仓库(项目):

git remote add google-origin https://github.com/googlesamples/google-services.git

获取分支:

git fetch google-origin feature/20181118

检出项目并切换分支:

git checkout -b feature/20181118 --track google-origin/feature/20181118
git