Updating project changes in an old commit – git

I have a particular commit for my Xcode Project. I need to undo the settings change, that I made in that particular commit (not the previous commit). How do I go about this? I can update the project settings only from the Xcode project but not using the diff file. Can anyone tell me how to approach this issue?

  • Cannot Git Push from Xcode 5 using my user name
  • Bitbucket + XCode 4.2 + Git
  • Project architecture with CocoaPods - Private main-project and public sub-project
  • .gitignore file, where should I put it in my xcode project?
  • Xcode Bot CI | Unable to find matching destination
  • Where is git repository of Xcode stored? And Why different repository is created when I copy project directory?
  • The Repository is Locked - Error while trying to commit into source control
  • Why does creating new branches in Xcode9 always fail with “not a valid branch name”?
  • One Solution collect form web for “Updating project changes in an old commit – git”

    You have two options. You can either nuke the previous commit, or you can amend the file that has the settings change and make a new commit on top of your branch.

    Option 1

    git reset --hard HEAD~1
    git push origin your_branch --force
    

    This will roll your entire branch back to the previous commit, then overwrite the repository. You will have succeeded in undoing the settings change, but you will also be overwriting all the other changes, which you very well might want to keep.

    Option 2

    git checkout <SHA-1> settings_file
    

    where <SHA-1> is the SHA-1 hash of the most recent commit you made to your branch. This command will overwrite the settings file in your local repo with the previous version you actually want. You can also make new changes to the settings file, and when you are finished, you can commit using:

    git commit -m 'Updated settings file'
    git push origin your_branch
    

    Option 2 basically adds a new commit to undo the change you made to your settings file, while Option 1 erases the changes from ever having been made. You probably want to go with Option 2 though.

    Git Baby is a git and github fan, let's start git clone.