我希望我的.gitignore忽略某些文件夹和文件,所以我想出了以下内容:的Git忽略不忽略指定的文件夹/文件
*.class
# usual java ignores
bin/
.metadata
# Maven
*/target/*
target/*
/target/
*/deploy/*
deploy/*
# src-gen folder is populated by the command of protobuf, these files should not be pushed
src-gen/*
# eclipse generated stuff
dependency-reduced-pom.xml
# we shouldn't have .jar files in our repository,
# apart from these 5 jars which are vital for our build process
*.jar
!/projectName/bundle/**/*.jar
# For Unix editors
# sometimes make file copies ending
# with ~
# To ignore them use:
*~
# For Mac
.DS_Store
._*
# For markdown read me files
.README.md.html
然而,git status
后,我看不到任何东西作为输出被删除。请注意,这是一个子模块,如果这很重要的话。我希望这个.gitignore
在不指定任何文件夹名称的情况下忽略所有内容,因为我不需要任何硬编码。
这里的文件夹结构,我有:
+ parentRepo
+ thisRepo
+ .gitignore
+ projectName
+ src-gen
+ target
+ deploy
+ dependency-reduced-pom.xml
+ bundle
+ system
+ 1.jar
+ 2.jar
+ 3.jar
+ 4.jar
+ 5.jar
因此,我将只有1.gitignore(在父目录中),它也会为子模块做所有事情? –
是的,但要确保你想忽略的文件,你没有将文件添加到git仓库。 – Aakash
[一些](http://stackoverflow.com/a/5127213/6533075)对所有的'.gitignore'说不同。 –