【发布时间】:2011-10-03 02:43:38
【问题描述】:
我想在我的公共分支中排除一个名为 config/dbconfig.js 的文件,我用它来推送到 github,但仍然能够从 master 推送到我的 noester.com git repo 以推送到生产环境。我将配置文件更改为:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
excludesfile = +info/exclude
[remote "nodester"]
url = *** My Git Repo ***
fetch = +refs/heads/*:refs/remotes/nodester/*
[branch "public"]
excludesfile = +info/exclude_public
我确保删除 .gitignore 文件,我使用 .git/info/exclude 文件进行一般排除,并希望使用 .git/info/exclude_public 排除该文件,所以当我合并时公开该文件不会合并也不会推送到 github。
如果我执行以下操作,即使在公共分支中,它仍会将文件添加到 git。所以我在想我的语法错误或者不可能。
$ git checkout public
$ git add .
$ git status
# On branch public
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: config/dbconfig.json
#
如果这不可能,是否有更好的方法来处理您不想在开放的 Github 项目中退出而不运行两个 git 存储库并在它们之间手动合并的数据库配置?
【问题讨论】: