Git добавить не сценические файлы - Git кеш перепутал? - PullRequest
0 голосов
/ 02 января 2019

У меня такое чувство, что мой git-кэш довольно часто запутывается. Я работаю на Mac и использую как git на терминале, так и SourceTree.

Я добавляю или изменяю несколько файлов, но часто замечаю, что даже файлы, которые я никогда не модифицировал, отображаются как подготовленные. Это уже очень запутанно.

Однако, еще более запутанным является то, что часто выдает команду git add . для добавления всех файлов в промежуточную область. Я использую git в течение нескольких лет и никогда не имел этого раньше.

Я прочитал все сообщения здесь на SO, и ни один из них не решил эту проблему для меня. Я нашел одно предложение очистить кеш git, как:

git rm --cached path/to/file
git commit -m "Repair confused cache"
git add path/to/file
git commit -m "Add file"

Это временно разрешило проблему, но вскоре ситуация снова начинает происходить.

Я также вижу, что git ls-list --cache возвращает большинство файлов дважды, включая их хэш-коды, которые идентичны приведенным ниже, и файлы могут быть изображениями в формате png, файлами кодов и т. Д.:

mymbp:source username$ cd MySolution/
mymbp:MySolution username$ git ls-files --stage
100644 a658bb41271a4285977d1074a69f3302ab5cc15e 0    .gitignore
100644 a658bb41271a4285977d1074a69f3302ab5cc15e 0    .gitignore
100644 197079698252f7f85d6b1e3f68582b9cd1a9288b 0    Publishing/GooglePlay/Icons/res/mipmap-hdpi/icon.png
100644 197079698252f7f85d6b1e3f68582b9cd1a9288b 0    Publishing/GooglePlay/Icons/res/mipmap-hdpi/icon.png
100644 f03e22933ff168571cc5efac90fd4a9bbb4e5968 0    Publishing/GooglePlay/Icons/res/mipmap-mdpi/icon.png
100644 f03e22933ff168571cc5efac90fd4a9bbb4e5968 0    Publishing/GooglePlay/Icons/res/mipmap-mdpi/icon.png
100644 9f8a69a800369b1fd37061b46e808c62747115ac 0    Publishing/GooglePlay/Icons/res/mipmap-xhdpi/icon.png
100644 9f8a69a800369b1fd37061b46e808c62747115ac 0    Publishing/GooglePlay/Icons/res/mipmap-xhdpi/icon.png
100644 64c4174f8086fb7788c5ca922fd4411d8f5050ac 0    Publishing/GooglePlay/Icons/res/mipmap-xxhdpi/icon.png
100644 64c4174f8086fb7788c5ca922fd4411d8f5050ac 0    Publishing/GooglePlay/Icons/res/mipmap-xxhdpi/icon.png
100644 97a01523dd3909b8361d96c1ebd69373db33983f 0    Publishing/GooglePlay/Icons/res/mipmap-xxxhdpi/icon.png
100644 97a01523dd3909b8361d96c1ebd69373db33983f 0    Publishing/GooglePlay/Icons/res/mipmap-xxxhdpi/icon.png
100644 ab64f8448c2d2c74564c00f1cd1aca8bf1dbf200 0    Publishing/GooglePlay/Icons/web_hi_res_512.png
100644 ab64f8448c2d2c74564c00f1cd1aca8bf1dbf200 0    Publishing/GooglePlay/Icons/web_hi_res_512.png

ОБНОВЛЕНИЕ 1

Выход git config --list --show-origin:

dinosmbp:MySolution dinob$ git config --list --show-origin
file:/usr/local/etc/gitconfig   credential.helper=osxkeychain
file:/Users/dinob/.gitconfig    core.excludesfile=/Users/dinob/.gitignore_global
file:/Users/dinob/.gitconfig    user.name=DinoB
file:/Users/dinob/.gitconfig    user.email=db@dbsystems.com
file:/Users/dinob/.gitconfig    color.ui=true
file:/Users/dinob/.gitconfig    color.status.changed=blue normal
file:/Users/dinob/.gitconfig    color.status.untracked=red normal
file:/Users/dinob/.gitconfig    color.status.added=magenta normal
file:/Users/dinob/.gitconfig    color.status.updated=green normal
file:/Users/dinob/.gitconfig    color.status.branch=yellow normal bold
file:/Users/dinob/.gitconfig    color.status.header=white normal bold
file:/Users/dinob/.gitconfig    commit.template=/Users/dinob/.dinosStandardCommitMsg
file:/Users/dinob/.gitconfig    diff.tool=meld
file:/Users/dinob/.gitconfig    difftool.prompt=false
file:/Users/dinob/.gitconfig    difftool.meld.trustexitcode=true
file:/Users/dinob/.gitconfig    difftool.meld.cmd=open -W -a Meld --args "$LOCAL" "$REMOTE"
file:/Users/dinob/.gitconfig    merge.tool=meld
file:/Users/dinob/.gitconfig    mergetool.prompt=false
file:/Users/dinob/.gitconfig    mergetool.meld.trustexitcode=true
file:/Users/dinob/.gitconfig    mergetool.meld.cmd=open -W -a Meld --args --auto-merge "$LOCAL" "$BASE" "$REMOTE" --output="$MERGED"
file:/Users/dinob/.gitconfig    difftool.sourcetree.cmd=/Applications/Meld.app/Contents/MacOS/Meld "$LOCAL" "$REMOTE"
file:/Users/dinob/.gitconfig    difftool.sourcetree.path=
file:/Users/dinob/.gitconfig    mergetool.sourcetree.cmd=/Applications/Meld.app/Contents/MacOS/Meld "$LOCAL" "$BASE" "$REMOTE" --auto-merge --output="$MERGED"
file:/Users/dinob/.gitconfig    mergetool.sourcetree.trustexitcode=true
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=true
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
file:.git/config        core.ignorecase=true
file:.git/config        core.precomposeunicode=true
file:.git/config        remote.origin.url=https://github.com/DBSystems/MySolution.git
file:.git/config        remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config        branch.develop.remote=origin
file:.git/config        branch.develop.merge=refs/heads/develop
dinosmbp:MySolution dinob$ 

ОБНОВЛЕНИЕ 2

Если я пытаюсь подготовить файл, который отказывается от него, от SourceTree, я получаю кратковременную загрузку в SourceTree (которая говорит мне, что он пытается его разместить), но затем он уходит и ничего не происходит, файл остается неизменным .

Если я пытаюсь подготовить файл, который отказывается от установки с git терминала, введя git add path/file или git add ., ничего не происходит, и файл не помещается

ОБНОВЛЕНИЕ 3

Вывод git ls-files --stage | hexdump -C ниже показывает два разных значения SHA для файла IoC.cs, который в настоящее время отказывается добавляться на сцену с помощью команды git add .:

0002ae90  63 73 0a 31 30 30 36 34  34 20 65 37 32 64 31 30  |cs.100644 e72d10|
0002aea0  63 34 31 65 66 31 37 36  64 31 63 35 62 63 66 30  |c41ef176d1c5bcf0|
0002aeb0  62 36 34 63 30 32 36 34  62 32 66 63 65 65 36 65  |b64c0264b2fcee6e|
0002aec0  31 62 20 30 09 53 71 75  69 72 72 65 6c 46 6f 48  |1b 0.SquirrelFoH|
0002aed0  2f 53 71 75 69 72 72 65  6c 2e 46 6f 48 2e 56 69  |/Squirrel.FoH.Vi|
0002aee0  65 77 4d 6f 64 65 6c 73  2f 49 6f 43 2f 49 6f 43  |ewModels/IoC/IoC|
0002aef0  2e 63 73 0a 31 30 30 36  34 34 20 32 62 31 39 61  |.cs.100644 2b19a|
0002af00  36 39 33 35 39 32 66 36  64 32 31 30 38 36 38 33  |693592f6d2108683|
0002af10  63 39 31 62 61 61 30 30  62 64 62 61 62 30 63 34  |c91baa00bdbab0c4|
0002af20  31 31 61 20 30 09 53 71  75 69 72 72 65 6c 46 6f  |11a 0.SquirrelFo|
0002af30  48 2f 53 71 75 69 72 72  65 6c 2e 46 6f 48 2e 56  |H/Squirrel.FoH.V|
0002af40  69 65 77 4d 6f 64 65 6c  73 2f 49 6f 43 2f 49 6f  |iewModels/IoC/Io|
0002af50  43 2e 63 73 0a 31 30 30  36 34 34 20 37 38 39 64  |C.cs.100644 789d|
...