我的.gitignore文件似乎工作不可預測。這裏有一個例子:.gitignore是否對空白敏感?
我就與文件跳回到bar.txt,我想忽略一個新的回購富:
[email protected]:~$ mkdir foo
[email protected]:~$ cd foo/
[email protected]:~/foo$ touch bar.txt
[email protected]:~/foo$ git init
Initialized empty Git repository in /home/pon2/foo/.git/
[email protected]:~/foo$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# bar.txt
nothing added to commit but untracked files present (use "git add" to track)
正如預期的那樣,跳回到bar.txt顯示爲未跟蹤。所以我告訴混帳忽略.txts,但我不小心添加一些尾隨空白:
[email protected]:~/foo$ echo "*.txt " > .gitignore
現在,當我檢查回購情況,Git並不跳回到bar.txt忽視:
[email protected]:~/foo$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
# bar.txt
nothing added to commit but untracked files present (use "git add" to track)
這是怎麼回事上?
只要您以問題的形式*提問您的問題,就可以問和回答您自己的問題:http://meta.stackexchange.com/questions/12513/should-i-not -answer-my-own-questions否則,這只是一篇博文,並不屬於此處。 –
因此,在gitignore手冊頁中向Git開發者發送一個補丁。 – jamessan
@GregHewgill,謝謝,修正。 – wvoq