Skip to content

Commit 5249c9c

Browse files
authored
Merge pull request #833 from daegontaven/master
Add version control ignores to gotchas
2 parents 9d95236 + ec5f791 commit 5249c9c

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

docs/writing/gotchas.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,27 @@ Here's nice trick for removing all of these files, if they already exist::
230230
Run that from the root directory of your project, and all ``.pyc`` files
231231
will suddenly vanish. Much better.
232232

233+
Version Control Ignores
234+
~~~~~~~~~~~~~~~~~~~~~~~
233235

236+
If you still need the ``.pyc`` files for performance reasons, you can always add them
237+
to the ignore files of your version control repositories. Popular version control
238+
systems have the ability to use wildcards defined in a file to apply special
239+
rules.
234240

241+
An ignore file will make sure the matching files don't get checked into the repository.
242+
Git_ uses ``.gitignore`` while Mercurial_ uses ``.hgignore``.
235243

244+
.. _Git: https://git-scm.com/
245+
.. _Mercurial: https://www.mercurial-scm.org/
236246

247+
At the minimum your ignore files should look like this.
237248

249+
::
238250

251+
syntax:glob # This line is not needed for .gitignore files.
252+
*.py[cod] # Will match .pyc, .pyo and .pyd files.
253+
__pycache__/ # Exclude the whole folder
239254

240-
241-
242-
255+
You may wish to include more files and directories depending on your needs.
256+
The next time you commit to the repository, these files will not be included.

0 commit comments

Comments
 (0)