What does the git index contain EXACTLY?

后端 未结 6 1324
谎友^
谎友^ 2020-11-22 17:28

What does the Git index exactly contain, and what command can I use to view the content of the index?


Update

Thanks for all your answe

6条回答
  •  死守一世寂寞
    2020-11-22 17:49

    In response to @ciro-santilli-%e9%83%9d%e6%b5%b7%e4%b8%9c%e5%86%a0%e7%8a%b6%e7%97%85%e5%85%ad%e5%9b%9b%e4%ba%8b%e4%bb%b6%e6%b3%95%e8%bd%ae%e5%8a%9f detailed in-depth look at the index, am sharing output for one of the TODO.

    "If you git add, then a stage 0 is added to the index for the path, and Git will know that the conflict has been marked as solved. TODO: check this."

    And, more specifically, the different merge stages.

    • 0: regular file, not in a merge conflict
    • 1: base
    • 2: ours
    • 3: theirs

    Details on the numerical representation of the various stages, in this case a file with conflict.

    $ git ls-files -s
    100644 f72d68f0d10f6efdb8adc8553a1df9c0444a0bec 0       vars/buildComponent.groovy
    
    $ git stash list
    stash@{0}: WIP on master: c40172e turn off notifications, temporarily
    
    $ git stash apply
    Auto-merging vars/commonUtils.groovy
    Auto-merging vars/buildComponent.groovy
    CONFLICT (content): Merge conflict in vars/buildComponent.groovy
    
    $ git ls-files -s
    100644 bc48727339d36f5d54e14081f8357a0168f4c665 1       vars/buildComponent.groovy
    100644 f72d68f0d10f6efdb8adc8553a1df9c0444a0bec 2       vars/buildComponent.groovy
    100644 24dd5be1783633bbb049b35fc01e8e88facb20e2 3       vars/buildComponent.groovy
    

提交回复
热议问题