I\'m in a situation where I want to open source my project, however there\'s a single source file that I want to release a \"clean\" version of, but use a separate version l
use update-index
, here are the docs.
Here is a basic example freezing a file foo.rb
:
git update-index --assume-unchanged foo.rb
Then, to get it back:
git update-index --no-assume-unchanged foo.rb
Or for simplicity, add it to .gitconfig
freeze = update-index --assume-unchanged
thaw = update-index --no-assume-unchanged
...
git freeze foo.rb
git thaw foo.rb
Note: This answer was originally provided by @TheAmpersand in comments above. I thought it was important enough to formalize.