Best practices for ignoring files pushed to git
Use the following best practice to help understand when you might want to ignore specific files in a Watson Studio Local project.
Adding a .gitignore file in a Watson Studio Local
project allows you to skip and ignore many of the .ipynb_checkpoints,
.pyc and other files that might not necessarily be wanted in git. Because these
files are updated frequently, without a .gitignore file you will receive almost constant "You have
uncommitted messages" messages in Watson Studio Local.
Scenario for understanding when to use a .gitignore file
When you're running Jupyter notebooks, a .ipynb_checkpoints/ directory is
created. The following scenario explains what happens when you use and don't use a
.gitignore file.
- Without .gitignore in place, every time a notebook is opened or modified, various temporary files are created and recommended to be committed.
- With .gitignore in place, only the notebook file is committed.
Adding a .gitignore file
When you add a .gitignore file to an existing Watson Studio Project, you can
control the list of files to ignore on a per-project basis. The .gitignore file
should be created in the root directory of each project.
- Navigate to.
- Open a terminal window for any of the environments.
- The terminal puts you in the project directory. Create a
.gitignorefile there.
Here's an example of .gitignore file contents below. You might want to add or remove certain file extensions depending on how you want to use the file.
# Skip the Watson Studio .projectrc
.project-rc
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Core files.
core.*
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# mkdocs documentation
/site
# mypy
.mypy_cache/