Home  >  Q&A  >  body text

如何判断git pull 成功

我在弄自动化代码部署。现在有点不明白。当用脚本去git pull origin master 后,有可能失败,有可能成功。那么有没有办法知道成功和失败的状态。
谢谢!

大家讲道理大家讲道理2727 days ago835

reply all(2)I'll reply

  • 为情所困

    为情所困2017-05-02 09:22:09

    It can usually be seen. If there is an error, it will usually be fatal, and you will be prompted as to why the error occurred: there may be a conflict, etc.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-02 09:22:09

    if [ $? == 0 ];then
      echo "success"
    else
        echo "fail"
    fi
    

    Try the above code

    reply
    0
  • Cancelreply