当我输入git status时,我收到以下消息:
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: .DS_Store
modified: README.txt
modified: lib/PriceSeries.rb
Untracked files:
(use "git add <file>..." to include in what will be committed)
MM8 Prices.pdf
prices from EH.xlsx
我希望能够说git add .
,而无需添加未跟踪的文件。我相信.gitignore文件应该是为了这个。我的.gitignore文件(在.git文件夹中)如下所示:
#Ignore all xlsx files
.xlsx
#Ignore all pdf file
.pdf
我做错了什么?
答案 0 :(得分:1)
使用*
:
#Ignore all xlsx files
*.xlsx
#Ignore all pdf file
*.pdf
[更新]此外,.gitignore
必须位于项目的根目录中,而不是.git
下