0

我的这个 Git 存储库有一个奇怪的问题,导致我的工作目录在与 github 进行一些交互后随机变脏。

通常我会检查我的更改:

root@debian:/var/www/MyDir# git status
    # On branch development
    # Changed but not updated:
    #   (use "git add <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #
    #   modified:   path-to-some-file1.css
    #   modified:   path-to-some-file2.js
    #   modified:   path-to-some-file3.html
    #
    no changes added to commit (use "git add" and/or "git commit -a")

提交他们:

root@debian:/var/www/MyDir# git commit -am "my custom"
    [development e9e4235] my custom
     3 files changed, 21 insertions(+), 48 deletions(-)

拉取和变基,因为我的更改很小,我不需要额外的“合并”提交:

root@debian:/var/www/MyDir# git pull --rebase
    Enter passphrase for key '/root/.ssh/id_rsa': 
    Current branch development is up to date.

推:

root@debian:/var/www/MyDir# git push
    Enter passphrase for key '/root/.ssh/id_rsa': 
    Counting objects: 21, done.
    Compressing objects: 100% (10/10), done.
    Writing objects: 100% (11/11), 1013 bytes, done.
    Total 11 (delta 9), reused 0 (delta 0)
    To git@github.com:User/MyRepo.git
       72612a8..e9e4235  HEAD -> development

检查我的状态,所有更改文件!“这很奇怪,我没有编辑那些……”

root@debian:/var/www/MyDir# git status
    # On branch development
    # Changes to be committed:
    #   (use "git reset HEAD <file>..." to unstage)
    #
    #   modified:   path-to-some-file-a-coworker-edited-in-a-previous-commit-4.css
    #   modified:   path-to-some-file-a-coworker-edited-in-a-previous-commit-5.css
    #   modified:   path-to-some-file-a-coworker-edited-in-a-previous-commit-6.css
    #   modified:   path-to-some-file-a-coworker-edited-in-a-previous-commit-7.css
    #
    # Changed but not updated:
    #   (use "git add <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #
    #   modified:   path-to-some-file-a-coworker-edited-in-a-previous-commit-4.css
    #   modified:   path-to-some-file-a-coworker-edited-in-a-previous-commit-5.css
    #   modified:   path-to-some-file-a-coworker-edited-in-a-previous-commit-6.css
    #   modified:   path-to-some-file-a-coworker-edited-in-a-previous-commit-7.css
    #

重置修复它:

root@debian:/var/www/MyDir# git reset

root@debian:/var/www/MyDir# git status
    # On branch development
    nothing to commit (working directory clean)

有人熟悉这种奇怪的行为吗?

这是正常的吗?我是在做完全错误的事情吗?或者这可能是 git 中的错误?

4

0 回答 0