Skip to content

Add version control ignores to gotchas #833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions docs/writing/gotchas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,27 @@ Here's nice trick for removing all of these files, if they already exist::
Run that from the root directory of your project, and all ``.pyc`` files
will suddenly vanish. Much better.

Version Control Ignores
~~~~~~~~~~~~~~~~~~~~~~~

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

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

.. _Git: https://git-scm.com/
.. _Mercurial: https://www.mercurial-scm.org/

At the minimum your ignore files should look like this.

::

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




You may wish to include more files and directories depending on your needs.
The next time you commit to the repository, these files will not be included.