Can't ignore UserInterfaceState.xcuserstate

后端 未结 12 2138
既然无缘
既然无缘 2020-12-22 14:08

I\'m using Git for Xcode 4 project version control. I\'ve explicitly added ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterface

相关标签:
12条回答
  • 2020-12-22 14:59

    Here is a very nice explanation of how to remove the files in question recursively from your git history: http://help.github.com/remove-sensitive-data/

    Very useful, because otherwise tools tend to 'hang' while trying to show the diff on those huge files that shouldn't have been checked in the first place...

    Here's what you can do (in short) to get rid of the largest stuff:

    cd YourProject
    git filter-branch --index-filter 'git rm --cached --ignore-unmatch -r YourProject.xcodeproj/project.xcworkspace' HEAD
    # see what you want to do with your remote here...
    # you can: git push origin master --force
    # or you can delete it and push a fresh new one from your cleaned-up local...
    rm -rf .git/refs/original
    git gc --prune=now
    git gc --aggressive --prune=now
    

    Worked very nicely for me :)

    0 讨论(0)
  • 2020-12-22 15:05

    This works for me

    1. Open the folder which contains the project file project.xcworkspace from the terminal.

    2. Write this command: git rm --cached *xcuserstate

    This will remove the file.

    0 讨论(0)
  • 2020-12-22 15:07

    All Answer is great but here is the one will remove for every user if you work in different Mac (Home and office)

    git rm --cache */UserInterfaceState.xcuserstate
    git commit -m "Never see you again, UserInterfaceState"
    
    0 讨论(0)
  • 2020-12-22 15:07

    Here are some demo & short cuts if you uses GitHub, the basic ideas are the same.

    1. Open terminal like this

    2. Paste the below command to terminal followed by a space and then paste the path of the .xcuserstate file simply like this

    git rm --cached

    3. Make sure you have the correct git ignore and then commit the code :)

    0 讨论(0)
  • 2020-12-22 15:07

    I think it would be better to write like this.

    git rm --cache *//UserInterfaceState.xcuserstate**

    0 讨论(0)
  • 2020-12-22 15:09

    Had a friend show me this amazing site https://www.gitignore.io/. Enter the IDE of your choice or other options and it will automatically generate a gitignore file consisting of useful ignores, one of which is the xcuserstate. You can preview the gitignore file before downloading.

    0 讨论(0)
提交回复
热议问题