git 远程仓库更新后,如何强制更新到本地的仓库?
PHP中文网
PHP中文网 2017-05-02 09:49:54
0
3
1147

是这样的,我们好几个人都拉取了同一个远程仓库到本地进行开发,然后我强制删除一个敏感文件及其相关的任何信息(比如提交历史记录等),然后使用git push origin master --force强制同步到远程仓库,到这一步远程仓库也没问题了,也干净了。

但是当其它人修改文件推送到远程仓库时又把我删除的那个文件推上去了,怎么才能让别人的本地仓库也干净,或者说如何让别人的本地仓库变为跟远程仓库一致?

PHP中文网
PHP中文网

认证0级讲师

reply all (3)
巴扎黑

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 themfetch之后rebasego to the latest submission. There must be conflicts that need to be resolved. Just don't add the deleted information back.

    PHPzhong

    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
      黄舟

      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?

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!