0

这是我的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

运行git add .之后git commit,大多数测试通过,但是当我尝试将一些更改推送到远程存储库时,它说,更改是最新的。

但是,当我尝试切换分支时,输出是一些文件应该被提交。

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

当我检查时,git status我可以看到需要提交的文件

这是输出:

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

任何帮助将不胜感激,因为我无法在另一个分支中继续编码。

4

0 回答 0