Add, commit to a local branch repository,
git add *.*
git commit -m "msg"
I push code to remote branch
git push branch
I get the same error on a Xcode specific file
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: abc/abc.xcodeproj/project.xcworkspace/xcuserdata/axz.xcuserdatad/UserInterfaceState.xcuserstate
I have to add and commit that file again and then push works
Next I merge my branch into main
git checkout main
git merge branch
I get same error on the same file Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: abc/abc.xcodeproj/project.xcworkspace/xcuserdata/axz.xcuserdatad/UserInterfaceState.xcuserstate
I have to add and commit the file and then push
git push
Then it works. I don't know why this specific file does not get included in the initial add/commit/push and I have to perform add/commit/push separately on this specific file.
This file UserInterfaceState.xcuserstate is specific to user I assume. As I work in team, so will I be overwriting someone else's UserInterfaceState.xcuserstate file? Can someone explain?
CodePudding user response:
xcuserdata
should be ignored from source control, you can add it to your .gitignore
.
xcuserdata/