可能重复:
没有二进制文件的gitignore
编辑:没有二进制文件的gitignore的 Dupe
当你编译一个Haskell文件(test.hs),使用时ghc --make test.hs,结果是test.hi和test.我只想添加和提交源test.hs,同时保留test.hi和test退出存储库但与源文件位于同一目录中. test是问题,如何指定.gitignore忽略没有扩展名的编译文件?
只需将文件名添加到您的.gitignore文件中.例如:
$ git ls-files --other --exclude-standard
test
$ echo test > .gitignore
$ git ls-files --other --exclude-standard
$
Run Code Online (Sandbox Code Playgroud)
.gitignore不关心扩展.它只是匹配模式.