10

I have recently set up a git repository on bitbucket, and have added an old project onto it. I have committed and pushed a change as a test, but now I face this problem.

Each time I try to Pull, Push, or Merge I get this error message:

The working copy "" has uncommitted changes.

"The working copy 'Project_Name' has uncommitted changes".

And I have committed this change several times:

The file seems to be named: User Interface State


EDIT: I did 'git status' and got the following:

# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   Crunch.xcodeproj/project.xcworkspace/xcuserdata/Neil.xcuserdatad/UserInterfaceState.xcuserstate
#
no changes added to commit (use "git add" and/or "git commit -a")

Help would be greatly appreciated, SirKaydian

Neil
  • 2,004
  • 3
  • 23
  • 48
  • U have checked using git status that u have no uncommited changes right? – NIlesh Sharma Aug 10 '12 at 22:53
  • How would I do that? I did "Refresh Status", still nothing. – Neil Aug 10 '12 at 23:25
  • 1
    I suggest navigating to the root of your project in a command prompt and doing a 'git status'. Alot of Git UIs are unreliable and won't tell you about unstaged files. You might have to do a 'git add .' to stage new files that have yet to be committed. – mockaroodev Aug 10 '12 at 23:43
  • Alright, I did the 'git status'. Check out the post. Also the `git add .` didn't do anything – Neil Aug 10 '12 at 23:48

5 Answers5

15

Step 1:

git rm --cached ProjectName.xcodeproj/project.xcworkspace/xcuserdata/username.xcuserdatad/UserInterfaceState.xcuserstate

Step 2:

git commit -m "Removed file that shouldn't be tracked"
whitneyland
  • 10,632
  • 9
  • 60
  • 68
Gangcil
  • 440
  • 3
  • 9
4

Okay, turns out I just had to make a comment

//THIS IS A TEST

And commit that. Now it works fine. This must have just been some strange bug.

Thanks for the help though, SirKaydian

Neil
  • 2,004
  • 3
  • 23
  • 48
1

I'm unfamiliar with the .xcuserstate file, but it sounds like a user-specific file. Generally user-specific files have no business in source control. They change frequently, generally are binary and thus difficult to diff, and aren't helpful to other users. Try closing down your IDE then running the commands or try adding this file name to your .gitignore file.

robrich
  • 13,017
  • 7
  • 36
  • 63
0

I solved this problem by:

git push <remote> localbranch --force.

Do not use the --force flag unless you’re absolutely sure you know what you’re doing.

haiwuxing
  • 1,162
  • 10
  • 12
-1
git rm --cached *.xcuserstate *.xcuserdata

Run the above command. Then commit, then push.

See here: Xcode says "Uncommitted Changes" Whenever I try to git pull or push

You may need to run them separately :

git rm --cached *.xcuserstate
git rm --cached *.xcuserdata
Community
  • 1
  • 1
MobileMon
  • 8,341
  • 5
  • 56
  • 75