search

Home  >  Q&A  >  body text

After updating the git remote warehouse, how to force the update to the local warehouse?

That’s it, several of us pulled the same remote repository locally for development, and then I forcibly deleted a sensitive file and any related information (such as commit history, etc.), and then used git push origin master --force forces synchronization to the remote warehouse. At this point, the remote warehouse is no longer a problem and is clean.

But when someone else modified the file and pushed it to the remote warehouse, the file I deleted was pushed up. How can I make other people’s local warehouses clean, or how can I make other people’s local warehouses consistent with the remote warehouse?

PHP中文网PHP中文网2804 days ago1260

reply all(3)I'll reply

  • 巴扎黑

    巴扎黑2017-05-02 09:51:54

    There is no obvious solution

    After all, everyone has done a lot of work on the original basis, so the forced update of their local libraries will not be displayed.
    The only thing you can do is to tell everyone else after you force the update and let them fetch之后rebasego to the latest submission. There must be conflicts that need to be resolved. Just don't add the deleted information back.

    reply
    0
  • PHPz

    PHPz2017-05-02 09:51:54

    You ask other colleagues to pull down the code from the remote warehouse and merge it locally when pushing code to the server. That means switching to the master branch first,

    git pull origin master

    Then, switch to your own branch

    git rebase master

    Finally, pushing

    git push origin master
    

    reply
    0
  • 黄舟

    黄舟2017-05-02 09:51:54

    Normally speaking, this situation will not happen. Because you have also modified the remote end, the version on your colleagues has fallen behind. They have to pull down the latest code from the remote end before pushing it. Is it possible? Are they also forced to recommend it like you?

    reply
    0
  • Cancelreply