1
我想用這種方式如何跟蹤子目錄中的某些文件,但不是所有其他文件與Git?
# Ignore everything
*
# But not these files...
!.gitignore
!/projectA/Makefile
!/projectB/Makefile
原來的Git無法跟蹤的Makefile文件的projectA
和projectB
子目錄跟蹤文件。一種解決方案是在子目錄中創建.gitignore
文件,但我不喜歡它,因爲我必須手動創建許多不同的.gitignore
文件。任何想法如何做到這一點在git根目錄的.gitignore
?
它似乎不工作。當我運行'git status'時,它將'projectA /'報告爲untracked而不是'projectA/Makefile' – RNA 2012-02-23 03:21:00
您只能看到文件夾的原因是您需要跟蹤文件夾才能跟蹤該文件夾中的任何內容。做'git add projectA',你只會在該文件夾中放置Makefile。 – Andy 2012-02-23 03:24:12
@ RNAer,改爲使用'git status --ignored --untracked-files = all'。 – Alexander 2012-02-23 03:26:24