I'm deploying a Rails app on Heroku (for now) via git, and would also like to have a public version for people to look at. Some files are sensitive and should only be committed and pushed in the "heroku" branch, but not the "public" branch. What is the best way to go about this?
(I do know about Heroku's Config variables, which is great as a temporary solution, but not fun if and when I need to switch hosts.)
The two branches don't need to be synced at all times - I'm okay with periodically merging the "master" branch into the "public" branch and pushing it to github separately.
I have tried various things:
separate
.gitignore
files and an "ours" merge strategy - this didn't work at first, and after messing with it for a while I decided it was getting too complicated just so I could achieve a seemingly simple taskusing a custom
exclude
file, and adding the following to.git/config
... this simply did not work:
.git/config
[branch "public"]
excludesfile = +info/exclude_from_public
What is the best way to have a private and public repository share the same code, but ignore sensitive files in the public repository?
You can assume that no code has been committed or pushed, i.e. this is a freshly initialized repository.
(This question has been asked before in various forms, but none of the answers were straight-forward or the answers seemed really hacky. I'm just here to ask this in a very simple manner, and hopefully receive a very simple response.)
.gitignore
this way, and the files will be added back into thepublic
branch when I rungit merge master
– Stigmasterol