【发布时间】:2011-12-23 02:18:43
【问题描述】:
我正在使用 heroku 开发 Django 应用程序,他们使用 git 推送代码。我的问题是他们需要这个文件结构:
heroku_project/
requirements.txt (this a pip requirements file)
procfile (this file tell heroku how to run your app)
django_project (the project itself)
lib
bin
build
lib (these 4 folders belong to my python virtual env)
所以我必须在这个文件夹上初始化我的 git,这意味着有这些附加文件:
heroku_Project/
.gitignore
.git
根据their instructions里面.gitignore应该有这些行:
bin
build
include
lib
.Python
*.pyc
问题是我想跟踪那些虚拟 env 文件夹,因为有时我安装 python 只是为了测试而我稍后丢弃它们,或者我对它们进行实验性更改,我希望我可以使用 git 撤消这些更改,我的问题是如何跟踪这些文件夹,所以我需要从.gitignore 中删除它们。问题是当我这样做时
git push heroku master
因为这会推送这些文件夹,而我们不希望这样,所以我如何有选择地推送文件和目录?或者你会使用什么样的工作流程来解决这个问题?
谢谢
【问题讨论】: