今回の方法は、既にプロジェクトがある場合に、UserInterfaceState.xcuserstateを差分としない方法です。
所定のリポジトリで、Macのターミナル操作
touch .gitignore
続けて
vi .gitignore
iを押して、編集モード
.DS_Store
*.swp
UserInterfaceState.xcuserstate
:wqで閉じる。コミットしてgitignoreをpush後
UserInterfaceState.xcuserstateがある一つ上の階層をshow in Finderでファイルをターミナルにドラッグ&ドロップしてEnter
git rm --cached ファイルをドラッグ&ドロップするとPathが自動で記載されます。
続けてEnter
git commit -m "removed cache."
push