Home  >  Q&A  >  body text

git push 之前忘记 git pull,已经commit了怎么办?

git push 之前忘记 git pull,怎么办?

PHP中文网PHP中文网2727 days ago1478

reply all(7)I'll reply

  • 大家讲道理

    大家讲道理2017-05-02 09:40:40

    Forgetting to pull before pushing will have a consequence, that is, if you push now, there will be a conflict (the error message is probably that the online version and the local version are out of sync and need to be merged), and the push will fail.

    Then you need to pull it down, merge it, and then you will be prompted for a conflict, then resolve the conflict, and then push it.

    Of course, if it is a small personal project, you can also add -f to force submission after confirming that there is no problem. The consequence is that the online version is forced to be overwritten (Don’t use it like this for multi-person collaboration! Don’t use it like this for multi-person collaboration! Don’t use it like this for multi-person collaboration! )

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-02 09:40:40

    You can pull after committing, otherwise Git is useless. When developing with multiple people, do you have to wait for others to finish writing and pull their code before you can start writing?

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-02 09:40:40

    git reset

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-02 09:40:40

    It should have been pulled after commit

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-02 09:40:40

    git add
    git commit -m ""
    git pull
    git push

    reply
    0
  • 迷茫

    迷茫2017-05-02 09:40:40

    git pull,然后在本地merge,再git push

    reply
    0
  • ringa_lee

    ringa_lee2017-05-02 09:40:40

    git reset
    git checkout

    reply
    0
  • Cancelreply