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

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

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

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

log/

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

/log

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

$ 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")

相关文章

学习编程是顺着互联网的发展潮流,是一件好事。新手如何学习...
IT行业是什么工作做什么?IT行业的工作有:产品策划类、页面...
女生学Java好就业吗?女生适合学Java编程吗?目前有不少女生...
Can’t connect to local MySQL server through socket \'/v...
oracle基本命令 一、登录操作 1.管理员登录 # 管理员登录 ...
一、背景 因为项目中需要通北京网络,所以需要连vpn,但是服...