[英]GIT: Unwanted files after a push
我正在使用 openshift,我有一个远程 git 存储库,如下所示:
.gitignore (contains "data/")
/source
- test.php
/data
- 1.png
- 2.jpg
我在我的电脑上签出这个存储库。 然后我更改test.php
。 同时,我删除了远程存储库中的文件: 1.png
& 2.jpg
并添加了文件smile.jpg
。
偏僻的:
.gitignore (contains "data/")
/source
- test.php
/data
- smile.jpg
当地的
.gitignore (contains "data/")
/source
- test.php (changed)
/data
- 1.png
- 2.jpg
然后当我: git add
/ git commit
/ git push
test.php
从我的电脑修改。 我的smile.png
被旧文件 ( 1.png
& 2.jpg
) 取代。
我做错了什么 ? 我想保留我的smile.jpg
文件。
PS:我的远程存储库是我的生产网站, data
包含所有上传的文件。 每次推送时,我上传的所有文件都会被删除:(
git status
之前git commit
$ git status
warning: LF will be replaced by CRLF in test.php.
The file will have its original line endings in your working directory.
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: test.php
如果在文件已添加到 git 后将data/*
文件夹添加到.gitignore
,则必须
$ git rm data/1.png ; git rm data/2.png
如果您使用的是 Openshift,则必须使用 openshift ~/app-root/data
文件夹。 以下问题应该可以帮助您解决问题如何在 OpenShift 中保持文件同步?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.