【问题标题】:How to remove the file from git bash screen and also delete that file from repository? [duplicate]如何从 git bash 屏幕中删除文件并从存储库中删除该文件? [复制]
【发布时间】:2020-06-17 16:30:21
【问题描述】:

我已从本地存储库中删除了这些文件,然后在此处显示为已删除。我也想从这个列表中删除它们。每次我使用 git checkout 文件名时,它都会从列表中删除它,但它也会在存储库中恢复。如何在删除文件的同时将其从列表中删除?

【问题讨论】:

  • 用 git filter-branch 指向答案?为什么?

标签: git


【解决方案1】:

简单stage then commit the deleted files:

git add --all $(git diff --diff-filter=D --name-only)
# or
git ls-files --deleted | xargs git add --all

然后

git commit -m "delete files"

【讨论】:

    猜你喜欢
    • 2011-01-04
    • 2012-02-23
    • 1970-01-01
    • 2010-09-11
    • 1970-01-01
    • 1970-01-01
    • 2021-10-08
    相关资源
    最近更新 更多