git 移除已经添加到版本库中的文件

  • A+
所属分类:Git

在开发中,不小心将数据库配置文件 database.php 加入到 git 版本中,那么如何移除呢?

首先找到 .gitignore 文件,将文件路径写入:

config/database.php

接下来在git版本库中删除 database.php:

git rm -r -cached .

git add .

git commit -m 'update .gitignore'

git push

既可以完成。

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: