替换远程git仓库(Heroku) [英] Replace remote git repo (Heroku)

查看:85
本文介绍了替换远程git仓库(Heroku)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是git和heroku的新手。



我在heroku上创建了一个应用程序,将一些文件推送到回购站。 b

现在我想用另一个文件夹中的新内容完全替换此应用程序的回购(并在该文件夹中有一个.git回购)。什么是正确的方法来做到这一点?

解决方案

如果您想完全替换您已经推送的提交历史记录新的第二次回购的历史,你需要做的就是:

  git remote在第一次回购中显示heroku 
cd / path / to / seconf / git / repo
git remote add heroku< heroku_repo_address_from_previous_command>
#例如:git remote add heroku git@heroku.com:appname.git
git push --force heroku master

这会将远程 heroku 回购的 master 分支替换为 master 第二个仓库的分支。但是,这将会松动(或者至少保留远程仓库的reflog)一段时间以前的仓库 master 分支的历史记录。



假设您可以在 Heroku快速入门页面之后重新使用您已创建的heroku凭证和 Heroku使用git页面部署


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 another folder (and have a .git repo in that folder). What is the right way to do this?

解决方案

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.

这篇关于替换远程git仓库(Heroku)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆