相关疑难解决方法(0)

我可以"提交"一个文件并忽略其内容更改吗?

我团队中的每个开发人员都有自己的本地配置.该配置信息存储在一个文件中,该文件devtargets.rb在我们的rake构建任务中使用.不过,我不希望开发人员破坏对方的devtargets文件.

我的第一个想法是将该文件放在.gitignore列表中,以便它不会被提交给git.

然后我开始想知道:是否可以提交文件,但忽略对文件的更改?所以,我会提交一个默认版本的文件,然后当开发人员在本地机器上更改它时,git会忽略这些更改,当你执行git status或git commit时它不会显示在已更改文件列表中.

那可能吗?这肯定是一个很好的功能......

git gitignore

325
推荐指数
4
解决办法
7万
查看次数

将文件保存在Git仓库中,但不跟踪更改

我在CodeIgniter站点中有几个文件,我希望在repo中有这些文件但不跟踪任何更改.

例如,我将此框架的新安装部署到新客户端,我希望下载以下文件(它们具有默认值CHANGEME),我只需要对此客户端进行特定更改(数据库凭据,电子邮件地址信息,自定义CSS).

// the production config files i want the files but they need to be updated to specific client needs
application/config/production/config.php
application/config/production/database.php
application/config/production/tank_auth.php
// index page, defines the environment (production|development)
/index.php
// all of the css/js cache (keep the folder but not the contents)
/assets/cache/*
// production user based styling (color, fonts etc) needs to be updated specific to client needs
/assets/frontend/css/user/frontend-user.css
Run Code Online (Sandbox Code Playgroud)

目前如果我跑

git clone git@github.com:user123/myRepo.git httpdocs
Run Code Online (Sandbox Code Playgroud)

然后编辑上面的文件,一切都很棒.直到我发布修补程序或补丁并运行git pull.然后我的所有更改都会被覆盖.

git

274
推荐指数
4
解决办法
7万
查看次数

标签 统计

git ×2

gitignore ×1