Replace remote git repo (Heroku)

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 [email protected]: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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)