2016-09-17 192 views
2

我有一个被忽略GIT文件夹public/lib忽略,因为我添加以下内容.gitignore文件:要跟踪文件/文件夹这是早些时候的.gitignore

public/lib 

我取得了初步committ &推变为远程存储库。后来意识到我需要提交public/lib中的一个文件夹,名为templates。然后,发现这种方法对Make .gitignore ignore everything except a few files

改变了我的.gitignore文件:

public/lib 
!public/lib/template/**/* 

这不是我的帮助。我没有看到GIT在下一个git status上考虑的template文件夹。

我是Git的新手。

+1

'git status --ignored'可以列出被忽略的文件。 'git add -f - ignored-files'可以强制添加被忽略的文件。 – ElpieKay

+0

该命令基本上添加了所有被忽略的文件/文件。我如何通过强制添加特定的文件夹? – BeingSuman

+0

将'ignored_files'更改为特定的文件/文件夹。 – ElpieKay

回答

1

您的白名单的子目录看起来有点关闭给我。试试这个:

public/lib    # blacklist public/lib folder 
!public/lib/template # but exclude the template subfolder 
+0

在'.gitignore'中加入'!public/lib/template'后,我希望'git status'能显示'template'文件夹为未跟踪文件夹,以便我可以接下来进行提交。那不会发生@Tim。这让我疯狂! – BeingSuman

+0

你不能在Git中添加空文件夹。请将文件添加到'public/lib/template',然后再次尝试'git status'。 –

+0

'template'文件夹已经有'css'&'js'文件夹,里面有文件!当我尝试'git status --ignore'它显示'忽略文件'部分下的'public/lib'文件夹。 – BeingSuman

相关问题