gitignore -项目中除去不需要在git中管理的文件

git项目中有些工程文件是不需要用git管理的,而且每次commit时都会被检测出,比较碍眼。

可通过设置gitignore来管理这些不需要显示的代码。

设置如下:

1. 打开git的项目的根目录中隐藏文件 .gitignore 文件。

vim .gitignore

2.编辑不使用的文件及文件夹。

26131210_gChr.jpg

3. 如果修改gitignore后不起作用,参考下文。

To untrack a single file that has already been added/initialized to your repository, i.e., stop tracking the file but not delete it from your system use: git rm --cached filename

To untrack every file that is now in your .gitignore:

First commit any outstanding code changes, and then, run this command:

git rm -r --cached .

This removes any changed files from the index(staging area), then just run:

git add .

Commit it:

git commit -m ".gitignore is now working"


转载于:https://my.oschina.net/u/2317656/blog/392004

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值