Add .gitigore file to git project
I haven't paid attention to this file before, but I recently read Huang Yong's "Architecture Adventure" and found it very useful.
The .gitigore file can be configured on its own.
I am using the configuration used in the book, which is concise and clear.
# Maven # target/#log#logs/# IDEA # .idea / * .iml # Eclipse # .settings / .metadata / .classpath.projectServers / # Mac # .DS_Store
In this way, these files will be automatically filtered out each time they are submitted. (I added the logs/ folder myself, and log4j configured the log output to the logs folder of the file root)
When submitting to the remote warehouse, you can avoid submitting some useless files.
How to add .gitigore files to previous projects
Here's a problem to solve. Files that don't need to be submitted can be filtered if they haven't been submitted before, but it won't work if they have been included in the version library with git.
Then we need to delete the file in the git library.
Let git stop tracking this file, submit it to the remote server, and delete the files we don't need to see on the remote server.
Git rm-cached file git pull
OK, so that our remote warehouse does not have those unnecessary files.