简体   繁体   中英

Replace remote Git repo with local

I have a remote on GitHub with an old version of my site that's no longer in use. I've since made significant changes to the local copy and want to merge these changes in. Is there a way that I can do this and keep the history that's already in the remote repo.

Is it simply a matter of copying the old .git directory to the new project and doing a git push --force to replace the remote version with my local changes? I would like to keep the same remote repo (and its history) if at all possible.

I think your question has already been answered just there .

Also, moving all files from one repo to another will keep the history of the destination repo (but not of the old one) so if you only need to keep the history of one of them, you can do it that way.

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