直接删除Github上的文件

直接删除Github上的文件

说明:此操作只删除Github上的文件,本地仓库文件不受影响

1.确定要删除哪个分支文件,以删除main为例,

1.找到本地仓库位置以StudyNote为例,右键 bash here

2.打开命令窗口,将Github的StudyNote文件全部拉取到本地仓库

css 复制代码
git pull origin main

3.若不是main主分支,使用checkout切换

css 复制代码
git checkout 目标分支名

4.查看拉取项目所有文件夹

css 复制代码
dir

5.要删除main主分支的Issue.md文件,切换到其所在为止Auto_test/Python/Issue.md

6.删除tIssue.md文件

css 复制代码
git rm -r --cached target  

7.删除文件后提交

css 复制代码
 git commit -m '删除Issue.md'        # 提交,添加操作说明

8.查看该文件是否删除

css 复制代码
dir

9.将远程仓库文件推送

css 复制代码
git push
相关推荐
John Song1 小时前
git多个账号管理
git·github
破烂pan3 小时前
github精选Agent学习repo
llm·github·agent
XU磊2603 小时前
Git 实现github仓库管理-删除指定目录下的所有文件并保留目录结构
git·github
逛逛GitHub10 小时前
1 天狂揽 4000 多 Star 的 AI 舆情分析开源神器。
github
卡洛斯(编程版11 小时前
大仓库推到GitHub大踩坑-Git LFS从安装到使用
git·github
玥轩_52111 小时前
Git命令速查手册
大数据·git·elasticsearch·gitee·github·命令速查
吃饺子不吃馅12 小时前
⚡️ Zustand 撤销重做利器:Zundo 实现原理深度解析
前端·javascript·github
whysqwhw12 小时前
KMP类GSON转字符串工具
github
CoderJia程序员甲13 小时前
GitHub 热榜项目 - 日榜(2025-11-06)
ai·开源·大模型·github·ai教程
诸葛思颖16 小时前
把本地 Python 项目用 Git 进行版本控制并推送到 GitHub
git·python·github