2

I did git status and saw a bunch of new files, e.g.:

Changes to be committed: (use "git reset HEAD ..." to unstage)

    new file:   project/swiftFile1.swift
    new file:   projec/swiftFile2.swift

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:   project.xcodeproj/project.pbxproj
    modified:   project.xcworkspace/xcuserdata/M.xcuserdatad/UserInterfaceState.xcuserstate

    Untracked files:
  (use "git add <file>..." to include in what will be committed)

    project.xcworkspace/xcuserdata/M.xcuserdatad/WorkspaceSettings.xcsettings

I did git add -A and it added to git all the files above, now I see there:

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   project.xcodeproj/project.pbxproj
    modified:   project.xcworkspace/xcuserdata/M.xcuserdatad/UserInterfaceState.xcuserstate
    new file:   project.xcworkspace/xcuserdata/M.xcuserdatad/WorkspaceSettings.xcsettings
    modified:   project/Base.lproj/Main.storyboard
    modified:   project/swiftFile1.swift
    modified:   project/swiftFile2.swift

And then I realized I don't want to push to the repo this file:

project.xcworkspace/xcuserdata/M.xcuserdatad/WorkspaceSettings.xcsettings

so before I do git push what could I do to stop committing this particular file (but not remove it from my hard drive)?

user3766930
  • 5,629
  • 10
  • 51
  • 104

1 Answers1

3

You have the answer in your question:

Changes to be committed: (use "git reset HEAD ..." to unstage)

To unstage the file, type:

git reset HEAD project.xcworkspace/xcuserdata/M.xcuserdatad/WorkspaceSettings.xcsettings 

I might add that this does not undo the changes you made to the file.

vauhochzett
  • 2,732
  • 2
  • 17
  • 40