Git
Overview¶
Git is a free and open source distributed version control system. Here are the official documentations and those for liaoxuefeng's wiki.
.gitignore¶
**Notes: **
Principle¶
- Ignore files automatically generated by the system or environment, such as thumbnails by Windows,
.idea
directory by IntelliJ IDEA. - Ignore intermediate files generated from compiling, such as
.class
compiled by Java. - Ignore files that contain private information, such as configuration file of password or token.
Rules¶
- A blank line matches no files.
- A line starting with
#
serves as a comment. - An optional prefix
!
which negates the pattern. It is not possible to re-include a file if a parent directory of that file is excluded. - The slash
/
is used as the directory separator. - If there is a separator
/
at the end of the pattern then the pattern will only match directories. **
matches multi-directories.?
and[]
are the same as those in regular expression.
For example:
/dir
to ignore the whole directory*.zip
to ignore all the files ending with '.zip'/dir/main.txt
to ignore the specified file!/dir/main.txt
not to ignore the file
Notes¶
Files already tracked by Git are not affected. To stop tracking a file that is currently tracked, use git rm --cached
.