search

Home  >  Q&A  >  body text

There are more git commits locally than remotely. Is it not possible to pull the code from the remote?

1. I pulled -f code from the remote gitlab, but the remote update could not be pulled. Later, I saw that there were more than 200 more local commits than the remote one. Is this the reason why I cannot pull the code from the remote warehouse? ? Do I have to push first before I can pull the code remotely?

过去多啦不再A梦过去多啦不再A梦2769 days ago682

reply all(5)I'll reply

  • ringa_lee

    ringa_lee2017-05-02 09:31:59

    Try git rebase origin/master

    reply
    0
  • 阿神

    阿神2017-05-02 09:31:59

    If you can’t pull down, it means you have no committed code locally, so you should either commit and push it up first, or git stash first and save it in the stack, then take it out at the appropriate time, and then git pull

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:31:59

    Try to manually fetch and merge, then push it up, or even rebase it

    reply
    0
  • PHP中文网

    PHP中文网2017-05-02 09:31:59

    git fetch

    reply
    0
  • 某草草

    某草草2017-05-02 09:31:59

    The local has more commit records than the remote, which means the local is newer than the remote, so it is not allowedpull

    If there is no conflict between the remote code and your local code, directly modify the local code commitpush to the remote one, and then it will be consistent.

    If there is a conflict when pushing, you can

    git fetch
    git rebase origin/master

    Follow the prompts to resolve conflicts.
    Then push local code to remote

    reply
    0
  • Cancelreply