• 请不要在回答技术问题时复制粘贴 AI 生成的内容
foaoo
V2EX  ›  程序员

关于Git,为什么我在本地push代码后,服务器没有同步删除不存在的文件?

  •  
  •   foaoo · Jan 10, 2012 · 11403 views
    This topic created in 5240 days ago, the information mentioned may be changed or developed.
    我在本地把文件删掉了(直接rm),然后提交代码,发现服务器的代码库里这个文件还存在。

    我一般用下面的代码来提交代码:

    git add .
    git commit -m 'update'
    git push origin master

    有没有办法让我不用 git rm xxx

    每次提交时,让服务器的版本库自动同步删除我在本地已经删除的文件?
    5 replies    1970-01-01 08:00:00 +08:00
    harryxu
        1
    harryxu  
       Jan 10, 2012 via Android
    要git rm
    Syndim
        2
    Syndim  
       Jan 10, 2012
    git -u
    Syndim
        3
    Syndim  
       Jan 10, 2012   ❤️ 1
    打错了,是git add -u
    foaoo
        4
    foaoo  
    OP
       Jan 10, 2012
    @Syndim 非常感谢。
    peizh2006
        5
    peizh2006  
       Jan 10, 2012
    @Syndim 感谢,又学了一招
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2926 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 12:58 · PVG 20:58 · LAX 05:58 · JFK 08:58
    ♥ Do have faith in what you're doing.