Is there a way to setup remote-specific .gitignores?

前端 未结 3 1595
醉梦人生
醉梦人生 2020-12-14 16:51

Is there a simple way to setup different .gitignore files for different remotes? I have a repository I push up to both Heroku and Github. I need database.yml for Heroku, b

3条回答
  •  -上瘾入骨i
    2020-12-14 17:15

    I don't know anything about the requirements for Heroku - hopefully Justice is right and you can simply avoid the problem. If you can't, or if someone else finds this who can't...

    If you want the two remotes to be mirrors (have the same commits), they must by definition have the same files in those commits. So, you have two choices: have file-for-repo-B in all repositories, even if they don't need it, or use a slightly messy workflow with two branches: master and for-repo-B. The only difference between the two branches would be the commits touching file-for-repo-B; the branch for-repo-B would always merge from master (but never the other way around!). Now you just have a different branch checked out in repo B, and all is good.

提交回复
热议问题