Hongmu Notes

Ignore dependency directories

The dependency directory is large and can be rebuilt, so it is the first item on the ignore list.
100% Browser local processing 0 Data upload

🙈 Select project type

It is recommended to put the temporary files of the editor and operating system into global ignore rules, and they can also be generated here.

💡 Instructions for use

  • Just check the languages and frameworks used in the project, and repeated rules will be automatically deduplicated. It is recommended to also check the editors and operating systems used by team members.
  • Keep annotation titles for future maintenance: when you look back a few months later, you'll still know why each set of rules was added.
  • Directory rules ending with a slash only match directories; when you need to retain an ignored file, append an exception rule starting with an exclamation mark in the custom area.
  • The rules only take effect on files that have not been included in management; if the target file is already tracked, it needs to be removed from the management list first.

The dependency directory is large and can be rebuilt, so it is the first item on the ignore list.

why ignore

Dependence directories can easily contain tens of thousands of files, and submissions will cause the warehouse to expand rapidly.

Dependent versions are locked by the manifest file and can be reinstalled after changing machines.

multi-package project

Dependency directories of subpackages also need to be ignored.

Rules written in the root directory list can cover each subdirectory.

When being tracked

Remove from the index first, then submit the removal record.

After confirming that the manifest has taken effect, local files can be retained.

Don't be one size fits all

If the self-developed local package directory needs to be shared, exception rules should be used instead.

Exactly match by directory name to avoid accidentally damaging source code directories with the same name.

Check method

Check whether there are files in the dependent directory in the to-be-submitted list.

After pulling the new branch, confirm that the collaborator has not committed.

Dependent directories can only be removed from the index, local files do not need to be deleted.

📖 Glossary

Ignore rules
A rule list that tells the version control tool which files do not need to be included in the management. It is usually placed in the project root directory and takes effect step by step.
Rule matching
Match one by one by path, supporting wildcards, exceptions starting with a slash at the end of the directory, and an exclamation mark; rules written later can overwrite rules written first.
Exclamation mark exception
Used to bring a file that has been ignored back into management, such as ignoring the entire directory but retaining one of the configuration files. The way to write it is to add an exclamation mark before the rule.
directory trailing slash
When the rule ends with a slash, only the directory will be matched. If it does not end with a slash, both files and directories with the same name will be matched. It is recommended to include a slash when writing dependent directories.
Tracked files
Files that have been included in version management will not automatically stop tracking due to new ignore rules. They need to be removed from the management list before submitting.
global ignore
Ignore rules that are saved on the local machine and are effective for all local repositories are suitable for temporary files of the editor and operating system, and do not need to be written into the project file.
Dependency directory
A directory automatically generated by a dependency management tool, such as the installation directory of a package manager. They are large and recreated from manifest files and are generally not managed.
Build product
The output directories and files generated by compilation or packaging can be regenerated from the source code and are usually ignored; exceptions will be made if they need to be released with the warehouse.
environment variable file
Files that store keys and local configuration must be ignored to avoid leakage; the team usually provides a separate sample file for reference.
lock file
Documentation relies on precise versions of files. Application projects usually need to be submitted to ensure a consistent environment, while library projects are subject to agreement.
Editor directory
The configuration directory automatically generated by the editor is a personal preference and is usually ignored; configurations shared by the team can be retained as an exception.
Rule merging order
Multiple rule files can be superimposed to take effect, and files within the project take precedence over global files; there are no side effects if the same rule appears repeatedly, and duplication is only for readability.

🔗 All keywords and tutorials

Keywords page of the tool12a

Return to tool home page

❓ FAQ

What should I do if the dependent directory has been submitted?
First remove it from the index and commit it, keep the local files, and then reinstall according to the manifest.
How many rules should be written for multi-package projects?
One directory name rule can cover each subdirectory, and there is no need to write it repeatedly for each subpackage.