git 忽略禁止更新和提交,该文件已经在版本库里面的文件夹操作

操作流程

# 1. 添加文件到忽略列表
echo "test.php" >> .gitignore

# 2. 提交忽略规则
git add .gitignore
git commit -m "Ignore test.php"

# 3. 从Git索引移除文件(保留本地文件)
git rm --cached test.php

# 4. 提交移除操作
git commit -m "Remove test.php from tracking"

# 5. 推送到远程
git push origin main

 

以此步骤

 

posted @ 2024-07-23 08:06  方达达  阅读(40)  评论(0)    收藏  举报