Search code examples
xcodegitatlassian-sourcetreexcode14

Xcode 14.1 automatically modifies the project.pbxproj file. How to discard this change?


I am running one iOS/Swift project in Xcode 14.1. Git showing project.pbxproj file modified. A few days back I merged some branches and pushed the changes. The branch is working for others but causing an issue for me. Even I did not modify any file after the push. I want to discard this local change. Please help me.

I tried to remove the changes with help of the following commands.

1. $git checkout . 
2. $git clean -d -f  

The change is disappear for a second after executing git checkout . but again shows the same changes after some time. After running the checkout terminal show the *Updated 1 path from the index* message. I tried to discard changes from the source tree but after refreshing it again showed modify.

Git difference is showing same file is added and deleted on same folder location. enter image description here


Solution

  • I tried all the ways mentioned here How do I discard unstaged changes in Git? But does not work anything for me.

    My Solution:

    Solution 1:

    I deleted the repo and took a fresh clone.

    Update

    Found another solution also, most of the time it works for me but in case it does not work for you go for the first solution.

    Step 1:

    Quite the Xcode

    Step 2:

    Discard the project file changes from either terminal using git checkout . or any UI tool.

    Step 3:

    Open your Xcode project. Hopefully, you will not get project file changes.