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?
- xcode 8 remove unused working copy under source control
- Why can't I run git commands after updating to OSX 10.10?
- Xcode 5 and shared Schemes
- How to connect one code into two git repositories?
- should I commit .xcodeproj file in SVN?
- How to get Jenkins to push to GitHub but not trigger a build off that push
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.
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.
git checkout <SHA-1> settings_file
<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.