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,
.ideadirectory by IntelliJ IDEA. - Ignore intermediate files generated from compiling, such as
.classcompiled 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:
/dirto ignore the whole directory*.zipto ignore all the files ending with '.zip'/dir/main.txtto ignore the specified file!/dir/main.txtnot 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.