0
Follow
0
View

How to completely replace remote repository git history with local copy?

huaiqiuqiu 注册会员
2023-01-25 22:34
  1. Delete the GitHub repository and make a new one. It can have the same name if you like. Make sure it is totally empty (do NOT make a ReadMe or anything like that).

  2. Set that new GitHub repo as the remote of your local repo (GitHub tells you how to do that when you create the repo).

  3. On your local machine, push every branch (you might, depending on your settings, be able to simplify with git push --all, but if not you will just have to push each branch individually).

dclhaolove 注册会员
2023-01-25 22:34

If it doesn't need to be the exact same Github repository, you might be able to follow the steps detailed here: https://docs.github.com/en/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-locally-hosted-code-to-github I am not entirely sure, but you might be able to also push to an existing repository as well with this method.