Git - 使开发和掌握跟踪不同的存储库。明智吗?

发布于 2024-11-05 15:51:47 字数 2004 浏览 0 评论 0原文

我有一个在 git 中的项目并部署到heroku。远程网址为 [email protected]:myappname.git< /code> 和 .git/config 看起来像这样:

[core]
  repositoryformatversion = 0
  filemode = true
  bare = false
  logallrefupdates = true
[remote "origin"]
  fetch = +refs/heads/*:refs/remotes/origin/*
  url = [email protected]:myappname.git
[branch "master"]
  remote = origin
  merge = refs/heads/master

我刚刚制作了一个名为“myappname-staging”的新 Heroku 应用程序,我想将其用作该应用程序的暂存站点。我想我应该将其设置为“主”分支推送到生产远程,“开发”分支推送到暂存远程。这是处理这种情况的明智/传统方法吗?

我不太清楚该怎么做。当我在 Heroku 上制作暂存应用程序时,它给了我这样的信息:

Creating myappname-staging.... done
http://myappname-staging.heroku.com/ | [email protected]:myappname-staging.git
Git remote heroku added

我的配置现在看起来像这样:

[core]
  repositoryformatversion = 0
  filemode = true
  bare = false
  logallrefupdates = true
[remote "origin"]
  fetch = +refs/heads/*:refs/remotes/origin/*
  url = [email protected]:myappnamestef.git
[branch "master"]
  remote = origin
  merge = refs/heads/master
[remote "heroku"]
  url = [email protected]:myappname-staging.git
  fetch = +refs/heads/*:refs/remotes/heroku/*
[remote "staging"]
  url = [email protected]:myappname-staging.git
  fetch = +refs/heads/*:refs/remotes/staging/*

谁能帮我纠正一下吗?

谢谢,马克斯

I have a project which is in git and deploys to heroku. The remote url is [email protected]:myappname.git and the .git/config looks like this:

[core]
  repositoryformatversion = 0
  filemode = true
  bare = false
  logallrefupdates = true
[remote "origin"]
  fetch = +refs/heads/*:refs/remotes/origin/*
  url = [email protected]:myappname.git
[branch "master"]
  remote = origin
  merge = refs/heads/master

I just made a new heroku app called "myappname-staging" which i want to use as a staging site for this app. I was thinking that i would set it up so that the "master" branch pushes to the production remote and the "development" branch pushes to the staging remote. Is this the sensible/conventional way to handle this situation?

I can't quite figure out how to do this. When i made the staging app on heroku it gave me this back:

Creating myappname-staging.... done
http://myappname-staging.heroku.com/ | [email protected]:myappname-staging.git
Git remote heroku added

And my config now looks like this:

[core]
  repositoryformatversion = 0
  filemode = true
  bare = false
  logallrefupdates = true
[remote "origin"]
  fetch = +refs/heads/*:refs/remotes/origin/*
  url = [email protected]:myappnamestef.git
[branch "master"]
  remote = origin
  merge = refs/heads/master
[remote "heroku"]
  url = [email protected]:myappname-staging.git
  fetch = +refs/heads/*:refs/remotes/heroku/*
[remote "staging"]
  url = [email protected]:myappname-staging.git
  fetch = +refs/heads/*:refs/remotes/staging/*

Can anyone set me straight?

thanks, max

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

作业与我同在 2024-11-12 15:51:47

添加以下内容:

[branch "development"]
  remote = staging
  merge = refs/heads/master

您可以通过以下方式从命令行执行此操作:

$ git config branch.development.remote staging
$ git config branch.development.merge refs/heads/master

这将设置 development 分支以跟踪暂存时的 master 分支。

Add this:

[branch "development"]
  remote = staging
  merge = refs/heads/master

You can do that from the command line via:

$ git config branch.development.remote staging
$ git config branch.development.merge refs/heads/master

That will set up the development branch to tracking the master branch on staging.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文