gh-pagesでデプロイするときに A branch named ${ branch name } already exists

npmのgh-pagesでgithub pages にデプロイしようとすると、

$ gh-pages -d ./

fatal: A branch named 'gh-pages' already exists.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webpack-cs-ltc@1.0.0 deploy: `gh-pages -d ./`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webpack-cs-ltc@1.0.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/username/.npm/_logs/2018-01-14T13_30_47_188Z-debug.log

github.com

キャッシュが残っているのが原因で、gh-pagesコマンドを実行する前にキャッシュを消せば解決した。

$ rm -rf node_modules/gh-pages/.cache && gh-pages -d ./