I have a local repo that contains all the code for cloud deployment. This repo contains lots of sensitive files specific to the cloud. All these files have already been committed to a private remote repo hosted on the deployment cloud. Now I want some way to commit that code to a public repo while excluding all the sensitive data files. I was going through this but I think my situation is a little bit different. My current local repo already contains all the sensitive files which have not been added to .gitignore file. If I happen to create a public branch from the deployment branch like this:
deployment: A ---> B ---> C ---> D
\ \ \ \
\ \ \ \
public: -> A' -> B' -> C' -> D'
Then, for the first iteration (A), I would have all those sensitive files in my repo once again. I would then have to do this to get rid of all those sensitive files, modify my .gitignore to exclude those files in future, and then push the public branch to remote.
However, I can't think of how this would go ahead in the future.
Should I be merging my public branch to the deployment? (I think NO)
When the deployment code is updated, how would I propagate those changes to the public branch? In that case, should I merge deployment branch with public?
Is there any simpler way to do all this?