[git] 如何删除仓库中的文件或文件夹

近日,一阵狂风乱做,扰的我心神不宁,结果一个push就把一个无关之人送上了github,真是天有不测风云,居然不支持直接删除,那要怎么把它删掉呢,于是乎,烧香求度娘,结果原来如此:

git rm -r --cached nobody    

命令解释:

  • git:不解释

  • rm:remove

  • -r:recursive(递归)

  • --cached

    Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone.
    (简单理解,就是只删除push给远端的,本地不删除)

  • nobody:你的目录名

你可能感兴趣的:(工具,#,git)