fatal: 'xxx' could be both a local file and a tracking branch.
現象
xyzブランチにチェックアウトしようとしたら
λ git checkout xyz
fatal: 'xyz' could be both a local file and a tracking branch.
Please use -- (and optionally --no-guess) to disambiguate
と出た。どうやら同名のxyzというフォルダがあり、
λ git checkout xyz
このxyzがブランチ名を指してるのかフォルダ名を指してるのか曖昧なことが原因らしい。
対策
こういうときは
λ git checkout xyz --
とすればcheckoutできる。
なぜこういういうことになるかと言うと、"--"の後に来る文字列は何かしらのファイルパスしかありえないので、そうでないxyzはブランチ名だ、とgit判断してくれるから、ということらしい。