从Git Commit中删除了文件

时间:2013-09-20 08:33:19

标签: git github

我的GIT分支中有一些提交的文件,我不想将它推送到我的存储库。如何取消它们并从我的分支中删除文件。

我总是得到这个文件:     “C:\ nppdf32Log \ debuglog.txt”

在我的提交中,我不明白如何从我的git提交中删除它。

当我在分支之间做差异时,我得到以下内容:

git diff feature_mentoring_connections_v2 --name-only
"C:\\nppdf32Log\\debuglog.txt"
app/controllers/mentoring_models_controller.rb
app/helpers/mentoring_models_helper.rb
app/models/object_permission.rb
app/models/program_observer.rb

现在我需要从我的分支中删除“C:\ nppdf32Log \ debuglog.txt”。

这是解决方案:

git rm "C:\\nppdf32Log\\debuglog.txt"
git commit -m "Remove Files"

1 个答案:

答案 0 :(得分:1)

对于已签入的文件:

您必须还原先前的提交。因此,当您提交时,列表中将有2个项目,第一次提交和第二次还原提交。别担心。这些2的净效应将为零。

对于您不希望成为回购的一部分的其他文件,请跟踪它们。

相关问题