使用Git管理框架,忽略第一次拉动后给定文件的更改 [英] Managing a framework with Git, ignoring changes to given files after first pull
问题描述
我使用git来管理扩展的CodeIgniter框架。它是当前CI版本的一个克隆,包含额外的帮助器,库等。
我有许多站点都使用这个框架,如果我添加一个新的辅助方法或修复一个bug在一个站点中,我希望能够轻松更新所有其他站点,而不会覆盖任何自定义文件。
我希望实现以下工作流程
- 创建一个新的站点目录
git init
来初始化一个空的本地git repo - 将此链接与远程框架repo
git remote add origin git@github.com:username / framework_repo
- 一个新的远程框架副本
git pull origin master
- 更改站点文件并将它们提交回远程仓库
git push origin master
- 将这些更改提交到其他网站
- 重复步骤4& 5
这就好,但::
- 像config.php和database.php这样的文件不应该被提交回远程仓库,因为它们对于每个站点都是唯一的。
- 但是我希望它们存在于远程仓库中在第一次请求时,默认文件会被下载到我的本地目录中。
- 更进一步,如果我从远程仓库再次执行更新以更新框架,我不希望这些文件被覆盖
达到此目的的最佳方法是什么?一些.gitignore伏都教?
我已经使用.gitignore忽略文件,但在这种情况下,它略有不同,因为我只想在第一次请求时拉取文件。
我希望这就说得通了。
将所有不应该在repo中的文件放到 创建像 完成第一步! I'm using git to manage an extended CodeIgniter Framework. It's a clone of the current CI release with extra helpers, libraries ect. I have many sites all using this framework and if I add a new helper method or fix a bug in one site I want to be able to easily update all the other sites without overwriting any of their custom files. I wish to achieve the following workflow Thats all fine, BUT: Whats the best way to achieve this? Some .gitignore voodoo?
I already use .gitignore to ignore files, but in this case its slightly different as I want to pull the file only on the first request. I hope that makes sense. Put all the files that shouldn't be in the repo to the create dummy files like done with the first to steps! 这篇关于使用Git管理框架,忽略第一次拉动后给定文件的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
返还给远程仓库,因为它们是每个站点唯一的
。
.gitignore
文件中。
请求时,默认文件是
下载到我的本地目录中。
config.default.php
这样的虚拟文件,并在第一次拉动后将它们复制到忽略的名称。
框架,我不希望这些文件
被覆盖
git init
to initialise a blank local git repogit remote add origin git@github.com:username/framework_repo
git pull origin master
git push origin master
.gitignore
file. That is hardly any vodoo, it's just a list of files that should be ignored.
config.default.php
and copy them after the first pull to the ignored name.