Replace remote git repo (Heroku)

前端 未结 1 1425
一个人的身影
一个人的身影 2020-12-13 02:32

i\'m new to git and heroku.

I\'ve created an app on heroku, pushed some files to the repo.

Now I want fully replace this app\'s repo with new content from an

相关标签:
1条回答
  • 2020-12-13 03:05

    If you want to completely replace the history of the commits you already pushed by the history of that new second repo, all you should need to do would be:

    git remote show heroku in the first repo
    cd /path/to/seconf/git/repo
    git remote add heroku <heroku_repo_address_from_previous_command>
    # for instance: git remote add heroku git@heroku.com:appname.git
    git push --force heroku master
    

    That would replace the master branch of the remote heroku repo by the master branch of your second repo. But that would loose (or at least keep in reflogs of the remote repo for a while) the history of the master branch of the former repo.

    This assume you can reuse your heroku credentials you already created, following the Heroku quick start page and the Heroku Deploying with git page.

    0 讨论(0)
提交回复
热议问题