仅用于分支的Git Config excludesfile
我想在我的公共分支中排除一个名为config/dbconfig.js的文件,我使用该文件将其推送到github,但仍然能够从master推送到noester.com git repo以推送到生产。我将配置文件更改为:仅用于分支的Git Config excludesfile,git,github,Git,Github,我想在我的公共分支中排除一个名为config/dbconfig.js的文件,我使用该文件将其推送到github,但仍然能够从master推送到noester.com git repo以推送到生产。我将配置文件更改为: [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true excludesfile = +info/exclude [remote "nodes
[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\u public来排除该文件,因此当我合并到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
#
$git签出公共
$git add。
$git状态
#关于公共部门
#要提交的更改:
#(使用“git重置磁头…”取消分级)
#
#新文件:config/dbconfig.json
#
如果这是不可能的,有没有更好的方法来处理数据库配置您不想在不运行两个git存储库并手动在它们之间合并的情况下退出一个开放的Github项目?对于配置文件,最好处理内容过滤器驱动程序,而不是尝试忽略某些分支的文件 你会:
- 存储配置文件模板
- 存储公共价值
- 让内容过滤器“
”脚本使用模板和公共值构建目标配置文件,smudge
... 除非该脚本检测到它在部署环境中,在这种情况下,它将使用来自该服务器上另一个源的值(而不是存储在repo中的公共值)
- ”“或者
- “”