社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Git

如何通过git bash删除github远程repo上没有扩展名(二进制可执行文件)的文件?

Aashutosh Taikar • 5 年前 • 1533 次点击  

假设我的根repo中有一个没有扩展名(二进制可执行文件)的文件。我想知道如何通过git bash删除它。例如,在git回购中:

> ls  
client  client.c  server  server.c

注意,服务器、客户端没有扩展名。我想知道是否有任何方法可以使用通配符方法删除它们 * .

我试过以下方法,但不起作用:

> git rm --cached '\*.'
fatal: pathspec '*.' did not match any files
> git rm --cached '\*./'
fatal: pathspec '*./' did not match any files
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/49862
 
1533 次点击  
文章 [ 1 ]  |  最新文章 5 年前
Chris
Reply   •   1 楼
Chris    6 年前

没有必要用地球仪。只需使用文件名:

git rm client server

我想知道是否有任何方法可以使用通配符方法删除它们 * .

平原 * 地球上没有任何 . 会匹配文件,但也会匹配目录中的大多数内容(基本上是任何没有隐藏前缀的内容 . 本身)。

如果您确实需要执行通配符之类的操作,并且您的文件是可执行的,则可以尝试使用 find ,例如:

find . -maxdepth 1 -executable -type f -exec git rm --cached {} +

man find 关于它的许多选择的细节。