保持分支的设置 [英] Keep settings in branch
问题描述
我开始使用git进行软件开发。
我在github上有一个项目。此项目还涉及一些用户设置存储在专用的设置文件。
在github上,设置应该是空的(像这样)
###设置:
##您的名字
$ name =;
##您的电子邮件地址
$ email =;
##等等
但是,我也有在我的电脑上运行的项目(或服务器)。我的个人版本的项目应该填写所有设置。
我想为此设置两个分支。个人分支应该包含我所有的设置。主分支应该是我开发软件和上传到github的那个分支。
我想不时将主分支合并到个人分支中保持我的系统是最新的。但是,无论何时我尝试合并分支,我的个人设置都会丢失。
有没有办法做到这一点,或者我只是做错了什么? / p>
在您的个人分支中,您可以保留:
config.template
)
任何 git checkout
都会触发该脚本作为内容过滤驱动程序。 p>
这样,您可以合并 ma ster
到你的个人分支上,只要你愿意,你的配置值不会被修改。
I begin to use git for software development.
I have a project on github. This project also involves some user-settings stored in dedicated settings-files.
On github the settings should be empty (like this)
### Settings:
## Your name
$name = "";
## Your email adress
$email = "";
## and so on
However, I also have the project running on my computer (or server). My personal version of the project should have all settings filled out.
I would like to have two branches for that. The personal branch should contain all my settings. The master branch should be the one where I develop the software and which I upload to github.
I would like to merge the master branch into the personal branch from time to time to keep my system up-to-date. However, whenever I try to merge the branches, my personal settings get lost.
Is there a way to do this or am I just doing something wrong (what)?
In your personal branch, you could keep:
- the GitHub config file unchanged (with no value), but with a different name (
config.template
for example) - a "value file" with your personal value
- a "smudge" script able to generate the actual config file using the template one and your personal values
That script is triggered on any git checkout
as a content filter driver.
That way, you can merge master
onto your personal branch as many time as you want, your config values will not be modified.
这篇关于保持分支的设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!