Can't exclude user interface state from commit in xcode

I can’t exclude user interface state file from commit.

Every time I’m trying to push to github it asks me to commit first and insert user interface state file into the changes (even if I didn’t move the mouse or interface at all it still is shown to commit!).

  • Does Gitorious have hooks for CIA commit notification?
  • What to do after typing in commit message for git?
  • could not open git/commit_editmsg
  • Is it possible to save a git commit message to a file in a pre-commit hook?
  • Remove a merge commit, keeping current changes
  • What is the difference between git commit and git commit-tree
  • I tried different methods, described in other similar topics. For example, I tried to add all possible cases of user interface into the .gitignore in root, like this:


    It didn’t work.
    I tried to clean the cache and reset git, didn’t help.

    Git status command says the following: “modified: .xcodeproj/project.xcworkspace/xcuserdata/.xcuserdatad/UserInterfaceState.xcuserstate”

    And it looks like this

    Please help (it is driving me crazy)!

  • git: which remote git branch had the last commit?
  • Git: overwriting code of one branch to another
  • Use Bitbucket Private Repository With Carthage That Ask For Passwords
  • git push error: Server aborted the SSL handshake
  • Git: checkout without running post-checkout hook
  • GitHub: ERROR: Repository not found. fatal: The remote end hung up unexpectedly (different from similar posts apparently)
  • 2 Solutions collect form web for “Can't exclude user interface state from commit in xcode”

    If those files are already committed, you need to remove them from the index before seeing your .gitignore file work.

    git rm --cached *.xcuserstate
    # or
    git rm -r --cached project.xcworkspace

    To add on to VonC’s answer after calling -rm you also have to commit and then push (do this in the terminal BEFORE touching Xcode or it’s git tools again), that solved my problem.


    git rm --cached *.xcuserstate
    git commit -m "Removed cached files"
    git push

    Then you can touch Xcode again

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