I have some files (i.e some version files) in a remote repository that shouldn't be changed by future commits. Is there a way to make sure that future users who commit to this file will not be able to override the file in the remote, but still be able to push. Is there an easier way to do this than using githooks? I don't want to create a commit that undo's a users change in a githook. Is there a cleaner way of doing this?
I think what you need based on your need is (I maybe wrong here) is to:-
To temporarily ignore changes in a certain file: run
git update-index --assume-unchanged <file>Then when you want to track changes again:
git update-index --no-assume-unchanged <file>
http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html
This will retain the file in your git repo. Any local changes made in that file will not be able to be added, committed and pushed to the remote repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With