最近在使用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")