Reputation: 502
I wanted to exclude a file called config/dbconfig.js in my public branch which I use to push to github but still be able to push from master to my noester.com git repo to push to production. I changed the config file to this:
[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
I made sure to remove the .gitignore file and I am using the .git/info/exclude file for the the general excludes and was hoping to use the .git/info/exclude_public to exclude that one file so when I merge to public that file doesn't merge as well as not push to github.
If I do the following it will still add the file to git even in the public branch. So I am thinking ether I have the syntax wrong or it's not possible.
$ 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
#
If this isn't possible is there a better way to deal with database configs you do not want to get out on a open Github project without running two git repositories and manually merge between them?
Upvotes: 3
Views: 1491
Reputation: 1324188
For config files, it is best to deals with content filter drivers than trying to ignore a file for certain branches.
You would:
smudge
' script build the target config file out of the template and public values,See for illustration:
Upvotes: 2