2012-08-01 60 views
0

我试图在Heroku上放置一个新的Rails应用程序,并删除了默认索引文件public/index.html。然而,令我惊讶的是,当我访问Heroku上的应用程序时,我显示了默认的索引页面,而不是我想要查看的索引。Git不会删除一个文件,并总是认为工作目录很脏

好吧,这有点奇怪,但我想可能有一些原因,比如Git没有从存储库中删除文件,即使我删除了它。于是我抬起头在互联网上如何给力的Git从库中删除文件,并用

git filter-branch --tree-filter 'rm public/index.html' HEAD

来到了,当我跑了这一点,但是,它说:“不能改写分支(ES)用肮脏的工作目录”。我不确定为什么我的工作目录是肮脏的,因为我刚刚提交,当我跑git status它说

# On branch master 
# Changes not staged for commit: 
# (use "git add/rm <file>..." to update what will be committed) 
# (use "git checkout -- <file>..." to discard changes in working directory) 
# 
# deleted: public/index.html 

这是令人困惑的我,因为我的index.html前一段删除公共/。为什么它应该是唯一的变化呢?不过,我跑git add .git commit -m "...",然后它说

# On branch master 
# Changes not staged for commit: 
# (use "git add/rm <file>..." to update what will be committed) 
# (use "git checkout -- <file>..." to discard changes in working directory) 
# 
# deleted: public/index.html 
# 
no changes added to commit (use "git add" and/or "git commit -a") 

我,激怒,试图git add .git status,只见这是根本就没有被添加的变化。 git add public/index.htmlgit rm public/index.html也没有为我做任何事情。然后我搜索了这个问题,并提出了一个StackOverflow文章,其中有人建议尝试刷新git stashgit stash apply。我做到了,但仍然无法正常工作。

有什么问题,我该如何解决?

+0

你需要“添加”删除的文件,然后提交。 – Thilo 2012-08-01 00:32:29

回答

3

我认为你必须提交基本的删除,所以做了git的承诺-a -m“[评论]”,然后它会接受你删除

0

关于git的过滤分支,它会删除如果这是你想要的,那么来自回购中所有提交的文件。在做之前只需进行提交或存储更改。如果你只是希望它从现在开始删除比seansmash的答案可能是你需要的。

相关问题