After updating the git remote warehouse, how to force the update to the local warehouse?
PHP中文网
PHP中文网 2017-05-02 09:49:54
0
3
1256

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中文网

认证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 them fetch之后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