0

I have built a webproject with a flat file cms, which basically stores all content in .yaml markdown files instead if a database and I‘m therefore able to control all the content with git. That's great for production, it allows me to have a editing history for every entry and pull the content from my origin to my local machine. That's why I also don‘t want to gitignore the /content folder.

I further have a stage environment where I develop all new features and let them tested by my customer. When the feature is ready I merge it with a release branch into master/production (trying to implement the git flow).

The problem: The stage is full of dummy content from me and also my customer and I don‘t want to delete this content. Neither do I want to copy/paste the production content into the release branch every time I deploy a new version.

I‘m asking myself, what is a good way to keep the dummy content out of production? As far as I know, I can‘t have multiple .gitignore files in different branches, which which I would be able to exclude some directories in specific branches. And I also don‘t know a way to exclude folders during a merge.

Does anybody have a good idea or can point me into the right direction?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Mista K.
  • 105
  • 9
  • "*…I can‘t have multiple `.gitignore` files in different branches…*" Why not? Certainly you can! – phd Aug 15 '21 at 12:26
  • would be you able to explain how? Whenever I change something in my .gitignore, it gets synced with the branch and therefore also merged into other branches. – Mista K. Aug 17 '21 at 08:40
  • [Ignore file during merge](https://stackoverflow.com/a/16455853/7976758) Found in https://stackoverflow.com/search?q=%5Bgit%5D+ignore+file+during+merge – phd Aug 17 '21 at 11:50

1 Answers1

0

The easiest way to do this is to store the content in a different folder, say, fixtures/content, and then symlink it to content in development, but not production.

Trying to ignore files during merge is not really going to work out well. Adding the files to .gitignore in one branch but not the other doesn't prevent the files from being merged because change in .gitignore don't affect files that are already tracked.

It is possible to merge from development to production, delete the files in production, and then keep them in development, but if you ever merge back from production to development, the files will be deleted, so I don't recommend that.

bk2204
  • 64,793
  • 6
  • 84
  • 100