跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • git rm 的文档好像前后矛盾,是哪里理解错了吗?
未分類
7 6 月 2021

git rm 的文档好像前后矛盾,是哪里理解错了吗?

git rm 的文档好像前后矛盾,是哪里理解错了吗?

資深大佬 : AndyAO 1

git-rm – Remove files from the working tree and from the index

Remove files matching pathspec from the index, or from the working tree and the index. git rm will not remove a file from just your working directory. (There is no option to remove a file only from the working tree and yet keep it in the index; use /bin/rm if you want to do that.)

这里摘录了 git rm 文档中的两段话。

第 1 段话说明 git rm 可以删除工作树中的文件,但第 2 段的意思好像是说,git rm不能从工作树中删除文件,如果需要的话必须使用/bin/rm才行。

感觉这两段话是前后矛盾的。

大佬有話說 (4)

  • 資深大佬 : AoEiuV020

    git rm 的文档好像前后矛盾,是哪里理解错了吗?

  • 資深大佬 : xuboying

    git rm 的操作是针对 git 系统的也就是必须被 index 索引的东西。
    如果你不想修改 git index,或者这个东西和 git 无关,就要用普通的 rm

  • 資深大佬 : noe132

    git rm:
    ✅ 从 index 删除
    ✅ 从 index 和 working tree 删除
    ❌ 从 working tree 删除

  • 主 資深大佬 : AndyAO

    问题已解决,谢谢

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具