Reputation: 25983
I'm writing an iOS app that uses a versioned Core Data model.
I just very nearly released a version of the app which crashed on upgrade because I'd accidentally edited the old version as well as creating a new one.
To stop this happening again, I'd like to flag the old versions in some way that prevents any check-in that modifies those files without first removing the flag.
To make things more complicated, I'm using git-svn, so having a read-only repo as a submodule won't work.
Upvotes: 10
Views: 5082
Reputation: 142174
Basically you cant.
Git will track changes done with chmod
if you did not turn the flag off.
You can use some workaround to do it.
Verify in your both local & server hooks that the desired file is not part of the diff
which means that it was not modified.
Since local hooks can be removed y user so you want to verify it in the server. can be done in the pre-receive or update
hooks.
git update-index --assume-unchanged
This will "ignore" any local changes made to this file.
Upvotes: 3
Reputation: 876
Have you considered tagging your versions? Tags are like read-only branches. You can move the tag pointer to a different branch but you'll have to use the force (-f) option so you'll at least have to think about what you're doing, you won't be doing it by accident. Here is a good reference on git tagging: https://git-scm.com/book/en/v2/Git-Basics-Tagging
Upvotes: 0