Home > Article > Web Front-end > Share an example tutorial on creating a .gitignore file
How to create a .gitignore file and ignore unnecessary submitted files
Just create a new .gitignore and declare the folders or files to be ignored in it, but the trouble comes again, because it starts with a dot. Without a file name, there is no way to create it directly in the windows directory. You must right-click Git Bash and create a new .gitignore file according to the Linux method. The specific steps are as follows:
1. In the folder where you need to create the .gitignore file, right-click and select
Git Bash to enter the command line and enter the directory where the project is located.
2. Enter touch .gitignore to generate a ".gitignore" file in the folder.
Then enter the folder and its files you want to ignore in the ".gitignore" file.
3. Then open the file with an editor for editing. If you are very good and familiar with vi editing commands under Linux, you can also use commands to declare rules. I won’t go into details here,
Attachment: How to wrap lines in the vi editor?
Summary: The difference between vi save and exit command File to be ignored. There are two modes for .gitignore file filtering, open mode and conservative mode
4.1 The open mode is responsible for setting which files and folders to filter
eg:
Filter folder settings:
/mtk/ Indicates filtering this folder
Filter file settings
Specifies filtering certain types of files:
*.zip
*.rar
*.via
*.tmp
The above is the detailed content of Share an example tutorial on creating a .gitignore file. For more information, please follow other related articles on the PHP Chinese website!