AndyAO
V2EX  ›  问与答

Git short status 中的 ORIG_PATH 在什么情况下会产生?

  •  1
     
  •   AndyAO · May 30, 2021 · 1318 views
    This topic created in 1838 days ago, the information mentioned may be changed or developed.

    git status -s中可能会出现XY ORIG_PATH -> PATH格式的内容,文档中说ORIG_PATH is only shown when the entry is renamed or copied.

    但是生成文件的副本之后,没有在信息中发现相关的内容。

    那么这种情况到底在什么时候才会出现呢?

            'abc'>'README.md'
            git add 'README.md'
            git commit -m 'README'
            Copy-Item -Path 'README.md' -Destination 'README - Copy.md'
            git status -s | Should -Be '?? "README - Copy.md"'
            git add 'README - Copy.md'
            git status -s | Should -Be 'A  "README - Copy.md"'
    
    1 replies    2021-05-30 12:03:06 +08:00
    keepMyselfClam
        1
    keepMyselfClam  
       May 30, 2021
    git 并不会记录文件的重命名或者拷贝信息,它只是基于文件内容比较相似来判定的.
    所以感觉你这源文件太短了,找个几百行的代码贴进去再试试.
    -
    另外,git 对重命名文件的历史追溯的支持不太好, 按照改名后的文件名追溯历史会在改名处断掉.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1135 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:12 · PVG 02:12 · LAX 11:12 · JFK 14:12
    ♥ Do have faith in what you're doing.