V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
foaoo
V2EX  ›  程序员

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

  •  
  •   foaoo · 2012-01-10 10:55:33 +08:00 · 10552 次点击
    这是一个创建于 4480 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我在本地把文件删掉了(直接rm),然后提交代码,发现服务器的代码库里这个文件还存在。

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

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

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

    每次提交时,让服务器的版本库自动同步删除我在本地已经删除的文件?
    5 条回复    1970-01-01 08:00:00 +08:00
    harryxu
        1
    harryxu  
       2012-01-10 10:57:37 +08:00 via Android
    要git rm
    Syndim
        2
    Syndim  
       2012-01-10 10:58:17 +08:00
    git -u
    Syndim
        3
    Syndim  
       2012-01-10 10:58:37 +08:00   ❤️ 1
    打错了,是git add -u
    foaoo
        4
    foaoo  
    OP
       2012-01-10 11:02:44 +08:00
    @Syndim 非常感谢。
    peizh2006
        5
    peizh2006  
       2012-01-10 11:11:08 +08:00
    @Syndim 感谢,又学了一招
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5417 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 07:08 · PVG 15:08 · LAX 00:08 · JFK 03:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.