I have created many blocks but as far as I know only by exporting them from database is the only way to have their code. Is there another way to have the files? because pushing and commiting .sql to rep is not the best practice.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
Well cms_block is a table and all is stored in the database fields. Why you you want to have them in a file ?
If you want to have a block content in a file, then what you need is to directly write the html code in a template and not using the block anymore.
If what you need is for some reason to get your block content in a file; you might want to create a command that will read cms_block and do it for yourself without going through sql.
Just so you know it is actually doable to add a cms content via hard code that saves the data you created every time you deploy. Sadly I can't explain further as I don't really know the logic behind the module created by one of our backend (I am frontend) and I can't really share the module due to company policies. Your best bet is to buy an extension cms content uploader.
Sorry if this is not much of a help.