here is my pre-commit-config.yaml
default_language_version:
# force all unspecified python hooks to run python3
python: python3
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-ast
- id: check-byte-order-marker
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-json
- id: pretty-format-json
args: [--autofix]
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: detect-aws-credentials
- id: detect-private-key
- id: end-of-file-fixer
- id: file-contents-sorter
- id: fix-encoding-pragma
- id: forbid-new-submodules
- id: mixed-line-ending
- id: name-tests-test
- id: no-commit-to-branch
args: [--branch, develop, --branch, master]
- id: requirements-txt-fixer
- id: sort-simple-yaml
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.4.4
hooks:
- id: autopep8
- repo: https://github.com/pre-commit/pre-commit
rev: v1.18.3
hooks:
- id: validate_manifest
- repo: https://github.com/asottile/pyupgrade
rev: v1.25.1
hooks:
- id: pyupgrade
- repo: meta
hooks:
- id: check-useless-excludes
- repo: https://github.com/ambv/black
rev: 19.3b0
hooks:
- id: black
language_version: python3.7
args: [-S, -l 99, --exclude="migrations|.venv|node_modules"]
- repo: https://github.com/egichuri/mirrors-future
rev: 1fed4cb06bab1cc93e42b080b6645dd47e029b04
hooks:
- id: future
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.3
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
After running git add .
then git commit
, most test pass but then when i try to push some changes to remote repository it says, changes are upto date.
However when i try to switch branches, the output is some files should be committed.
error: Your local changes to the following files would be overwritten by checkout:
backend/.gitignore
backend/users/models.py
frontend/.gitignore
Please commit your changes or stash them before you switch branches.
Aborting
when i check git status
i can see files that need to be commited
here is the output:
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: .pre-commit-config.yaml
modified: backend/.gitignore
modified: backend/backend/__pycache__/settings.cpython-38.pyc
modified: backend/db.sqlite3
modified: backend/users/migrations/0001_initial.py
modified: backend/users/models.py
modified: frontend/.gitignore
modified: setup.cfg
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: frontend/.gitignore
Any assistance would be appreciated as i'm unable to continue coding in another branch.