前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >.gitignore过滤当前目录下的文件夹,不影响其他目录

.gitignore过滤当前目录下的文件夹,不影响其他目录

作者头像
梦飞
发布2022-06-23 13:01:00
1.2K0
发布2022-06-23 13:01:00
举报
文章被收录于专栏:csdn文章同步csdn文章同步

最近在使用git时遇到一个问题, push到远程机器上时某个log文件夹丢失了,本地查找是有的,git status也显示clean:

代码语言:javascript
复制
$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

于是猜测可能是被.gitignore过滤了,打开之后果然,里面有一行:

代码语言:javascript
复制
log/

这一行本来是用来过滤当前目录的的log文件夹,结果其他地方的log文件夹也被过滤了,解决: 指明当前文件夹,改为:

代码语言:javascript
复制
/log

此时在git status就发现那个我想加入git的log文件夹出现了

代码语言:javascript
复制
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   .gitignore

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        src/main/java/sysu/newchain/consensus/pbft/msg/log/

no changes added to commit (use "git add" and/or "git commit -a")
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-02-13,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档