Skip to content

Version Control

You can find a great .gitignore example on GitHub for Python projects here:

https://github.com/github/gitignore/blob/main/Python.gitignore

I've included a condensed version with a few extra exclusions, add this to the root of your project directory:

.gitignore
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
*.manifest
*.spec
pip-log.txt
pip-delete-this-directory.txt
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
*.mo
*.pot
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
instance/
.webassets-cache
.scrapy
docs/_build/
.pybuilder/
target/
.ipynb_checkpoints
profile_default/
ipython_config.py
.pdm.toml
__pypackages__/
celerybeat-schedule
celerybeat.pid
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
/site
cython_debug/
.idea/
mnt

If you don't already have Git installed, install it using sudo dnf install git -y.

With .gitignore added to the root of your project directory, for reference here is an example of pushing an existing project to a new GitLab repository:

cd ~/projects/example-for-you
git init --initial-branch=main
git remote add origin git@gitlab.com:example/example-for-you.git
git add .
git commit -m "Initial commit"
git push -u origin main