We're using Hugo to create a blog with static pages. We're working out of the master branch and when ready to deploy to heroku:
- We commit all but the public/ files to git
- Merge master to the release branch
- Within release branch, regenerate /public using Hugo (with production params) and commit
- Push to heroku
So we need public/ to be ignored in master, but not in release.
Looking around, I've found this: Using git, how do I ignore a file in one branch but have it committed in another branch?
Problem with that is that the .git/info/exclude and .git/info/exclude_from_master files would have to be manually created for every new user to the repo and they could get the main part (exclude public/) out of sync.
I know that it's not a big deal to just commit the /public files from the master branch as long as we always regenerate them in release before deploy, but assuming I wanted to stick to the original plan, is there a better .gitignore strategy? Seems like I'd want to be able to put "public/" directly in the [branch "master"] section of .gitignore, but I don't believe that works.