Issues with git branch checkout due to untracked working tree files

I thought I put the days of Xcode + git issues behind me. Guess not. I am getting this git error when trying to checkout another branch.

error: The following untracked working tree files would be overwritten by checkout:
    RCAlpha.xcodeproj/project.xcworkspace/xcuserdata/andrewjl.xcuserdatad/UserInterfaceState.xcuserstate
    RCAlpha.xcodeproj/xcuserdata/andrewjl.xcuserdatad/xcschemes/RCAlpha.xcscheme
    RCAlpha.xcodeproj/xcuserdata/andrewjl.xcuserdatad/xcschemes/xcschememanagement.plist
Please move or remove them before you can switch branches.
Aborting

Very well I say, let me remove these files:

  • Unknown protocol error when using git-svn over HTTPS through a proxy server
  • How do you publish a typescript website to GitHub Pages using Visual Studio?
  • How can I unit test a PHP class method that executes a command-line program?
  • Git subtree merge, but keep local changes?
  • Version control advice to manage sites on a remote dedicated server
  • How to view stash date/timestamp next to stash id?
  • andrewjl$ git rm --cached RCAlpha.xcodeproj/project.xcworkspace/xcuserdata/andrewjl.xcuserdatad/UserInterfaceState.xcuserstate
    fatal: pathspec 'RCAlpha.xcodeproj/project.xcworkspace/xcuserdata/andrewjl.xcuserdatad/UserInterfaceState.xcuserstate' did not match any files
    

    At this point I’m not sure what to do. These files are all listed in my .gitignore and I also gave git clean -f -d a try as well. No dice. Anyone know what’s going on here?

  • Git, Tower, and SourceTree
  • Git plug in for aptana studio
  • Does Google Code have anything comparable to GitHub pull requests?
  • Git: error: RPC failed; result=22, HTTP code = 411
  • GIT stashed date
  • I use several computers with different gitconfigs. How do I stop leaking my e-mail addresses to GitHub?
  • 2 Solutions collect form web for “Issues with git branch checkout due to untracked working tree files”

    The files are untracked: git rm --cached cannot find them because there are not in the index. Just delete them, using your file manager or rm. Then checkout should work as expected. Note that git status will show you what git sees the files as (tracked, changed, untracked; with an additional option it will also display ignored files).

    they arent in git but there locally .. that means when you switch those would be lost and git doesnt allow that

    remove them locally:

    rm RCAlpha.xcodeproj/project.xcworkspace/xcuserdata/andrewjl.xcuserdatad/UserInterfaceState.xcuserstate RCAlpha.xcodeproj/xcuserdata/andrewjl.xcuserdatad/xcschemes/RCAlpha.xcscheme RCAlpha.xcodeproj/xcuserdata/andrewjl.xcuserdatad/xcschemes/xcschememanagement.plist
    

    they are recreated by xcode anyway. nothing important in there!

    Git Baby is a git and github fan, let's start git clone.