Git:管理我的应用程序的每个版本吗? [英] Git: Manage each version of my app?

查看:85
本文介绍了Git:管理我的应用程序的每个版本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用git和github,而我刚刚完成了iOS应用程序的1.0版本.从这里开始,我想知道git如何才能最好地为我服务.

I am using git and github, and I just finished the 1.0 version of my iOS app. From here, I am wondering how git can best serve me.

我真的只是在这里寻找最佳实践,以及其他人推荐的管理主要版本的建议.

I really am just looking for a best practice here, and what others recommend for managing major versions.

是否应该为每个新版本(例如1.1、1.5、2.0等)创建一个新分支?还是我应该继续推动master分支?如果是这样,我该怎么办?

Should I create a new branch for each new version, such as for 1.1, 1.5, 2.0, etc? Or should I just keep pushing to the master branch? If so, how do I do this?

推荐答案

我建议使用从v1.0完成以来,从您的master分支中添加一个名为v1.0的标记.

From your master branch since you are done v1.0 add a tag called v1.0.

git tag -a v1.0 -m "Tagging release 1.0"

这样,您始终可以随时通过调用git checkout [tag_name]

This way you can always come back to a specific version at any time by calling git checkout [tag_name]

另一种常见做法是使用分支来处理要素,直到要素稳定为止.

Another common practice is to use branches to work on features until they are stable.

git checkout -b [feature-branch]

这将创建一个新分支,命名为[feature-branch]中的任何内容,并将其检出.请确保从要开始使用该功能的位置执行此操作(通常从master开始).

That creates a new branch named whatever is in [feature-branch] and checks it out. Be sure to do this from where you want to start working on the feature (typically from master).

稳定后,便可以安全地合并到master中.从master运行:

Once stable they can then be safely merged into master. From master run:

git merge [feature-branch]

这样,您的master分支始终保持工作状态,只有准备好后,才添加已完成的项目.这样一来,您可以随时(理想情况下)保留该应用程序的工作副本以进行测试等.

This way your master branch always stays in a working state and only completed items get added once ready. This will allow you to keep a working copy of the app at all times (ideally anyways) for testing, etc.

您可以为应用程序的每个版本使用分支,但是使用标签可以使分支生效,因此您不会偶然合并到另一个分支版本.

You could use branches for each version of the application however using tags makes it so you can't merge into another branch version by accident.

这篇关于Git:管理我的应用程序的每个版本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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