Rails 和 Git 工作流程建议

发布于 2024-09-05 00:19:59 字数 455 浏览 9 评论 0原文

我需要一些关于我想要的 git 和 Rails 设置的建议。

基本上,对于我的第一个 Rails 应用程序,我使用了 GitHub 上的基本应用程序模板,然后进行了大量更改,现在拥有了一个相当定制的完整应用程序。

我现在已经提取了对基本应用程序模板中的文件所做的所有更改,并将更改提交到我的 github 存储库分支。理想情况下,我希望将基本应用程序模板作为我的应用程序中的分支,并与我的主应用程序一起重新设置它的基础。这实际上可能吗?

我想要这样做的原因是:我想让基本应用程序保持最新且功能正常,因此对于我的下一个项目,我可以从我的 github 分支克隆基本应用程序模板并开始工作。同样,如果有人修复了基本应用程序模板中的任何错误,我可以将这些修复程序与我将基本应用程序模板作为分支的任何应用程序合并吗?

这可能吗?有没有更好/更常见的方法来做到这一点?

提前致谢!

谢谢,

丹尼

I need some advice with my desired setup with git and Rails.

Basically for my first Rails application I used a base application template from GitHub, I then made a ton of changes and now have a full application which is fairly customised.

I have now extracted all of the changes I made to the files within the base application template and have committed the changes to my fork of the github repo. Ideally, I would like to have the base application template as a branch in my application and rebase it with my master. Is this actually possible?

The reason I want to do this: I want to keep the base application up to date and functional, so for my next project I can just clone the base application template from my github fork and get working. Likewise, if anyone fixes any bugs in the base application template, I could merge those fixes with any application I have the base application template as a branch?

Is this possible? Is there a better/more common way to do this?

Thanks in advance!

Thanks,

Danny

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

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

发布评论

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

评论(1

深陷 2024-09-12 00:19:59

这是一个有趣的想法,尽管我认为在一堆更新之上重新建立整个项目历史记录可能比您意识到的更困难。

以下是如何在伪 git 中做到这一点:-)

# First fork the app template on github
# Then clone it locally
git clone your_fork_of_app_template_url

# Setup a remote to the original repository (the one you forked from)
git remote add original_base original_app_template_url

# make a branch at the root so you have someplace to pull in new changes
git checkout -b app_template original_base/master

# go back to your master and write your app
git checkout master
git commit
git commit 
...

# Then later update your app template if it has changed
git checkout app_template
git pull original_base

# now Rebase your entire app on top of the updated template (not sure how to go about this with multiple branches like edge)
git checkout master
git rebase app_template

如果应用程序模板只是一个 gem 文件或插件集合,这可能会起作用。但即便如此,您最好还是合并 masterapp_template,这样您就不必重写整个应用历史记录。

That's a interesting idea, though I think it might be harder than you realize to rebase an entire project history ontop of a bunch of updates.

Here's how you could do it, in pseudo-git :-)

# First fork the app template on github
# Then clone it locally
git clone your_fork_of_app_template_url

# Setup a remote to the original repository (the one you forked from)
git remote add original_base original_app_template_url

# make a branch at the root so you have someplace to pull in new changes
git checkout -b app_template original_base/master

# go back to your master and write your app
git checkout master
git commit
git commit 
...

# Then later update your app template if it has changed
git checkout app_template
git pull original_base

# now Rebase your entire app on top of the updated template (not sure how to go about this with multiple branches like edge)
git checkout master
git rebase app_template

This might work out if the app template was just a gem-file or a collection of plugins. But even then, you might be better off just merging master and app_template so you wouldn't have to rewrite your entire app history.

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