简体   繁体   中英

How to undo an initial push to a Git repository

So, I started with an empty repository and wanted to copy an existing Git repository there. If I initially pushed the wrong existing repository to that new, empty repository, how would I go about reversing or undoing that initial push so I could push the proper existing repository to my new one?

You can simply force push the correct existing repository to the remote one. Everything that is there will be overwritten:

git push -f

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM