V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
AndyAO
V2EX  ›  问与答

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

  •  1
     
  •   AndyAO · 2021-05-30 10:33:41 +08:00 · 607 次点击
    这是一个创建于 1054 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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 条回复    2021-05-30 12:03:06 +08:00
    keepMyselfClam
        1
    keepMyselfClam  
       2021-05-30 12:03:06 +08:00
    git 并不会记录文件的重命名或者拷贝信息,它只是基于文件内容比较相似来判定的.
    所以感觉你这源文件太短了,找个几百行的代码贴进去再试试.
    -
    另外,git 对重命名文件的历史追溯的支持不太好, 按照改名后的文件名追溯历史会在改名处断掉.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2496 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:07 · PVG 00:07 · LAX 09:07 · JFK 12:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.