修订号码的Git等价物是什么? [英] What is the Git equivalent for revision number?

查看:99
本文介绍了修订号码的Git等价物是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在工作中使用SVN,但对于我的个人项目,我决定使用Git。所以我昨天安装了Git,我想知道Git中的修订版本号等同于 是什么。 在版本3.0.8上工作,每个错误修复都有自己的修订版本号,当我们讨论这个错误修复时,我们可以使用它。因此,如果我将Git中的代码标记为3.0.8,那么我可以将其用作修订版号或其他更详细的标识类型?我发现这个散列对人类来说并不那么用户友好。

解决方案

好消息或者坏消息,hash是修订号。当我从SVN切换到git时,我也遇到了麻烦。



您可以在git中使用标记将某个修订标记为发布一个特定的版本,可以很容易地引用该版本。看看这个博客文章



要理解的关键是git不能有修订版本号 - 考虑分散的本质。如果用户A和B都承诺到他们的本地仓库,git如何合理地分配一个顺序版本号?在推/拉对方的变化之前,A没有B的知识。



另一个需要注意的问题是bugfix分支的简化分支:

从版本3.0.8开始。然后,在发布后,执行以下操作:

  git分支bug修复308 

这将为bug修复创建一个分支。结帐分行:

  git checkout bugfixes308 

现在进行所需的任何bug修改。

  git commit -a 

提交它们并切换回主分支:

  git checkout master 

然后从其他分支:

  git merge bugfixes308 

通过这种方式,您可以获得单独的特定于发行版的bugfix分支,但您仍然将修补程序更改拖入您的主开发中心。


We use SVN at work, but for my personal projects I decided to use Git. So I installed Git yesterday, and I wonder what is the revision number equivalent in Git.

Let's say we work on version 3.0.8 and every bug fix has its own revision number we can use when we talk about this bug fix. So if I tag the code in Git to 3.0.8 what then I can use as a revision number or some other more detailed kind of identification? I find the hash not so user friendly for humans.

解决方案

Good or bad news for you, that hash IS the revision number. I also had trouble with this when I made the switch from SVN to git.

You can use "tagging" in git to tag a certain revision as the "release" for a specific version, making it easy to refer to that revision. Check out this blog post.

The key thing to understand is that git cannot have revision numbers - think about the decentralized nature. If users A and B are both committing to their local repositories, how can git reasonably assign a sequential revision number? A has no knowledge of B before they push/pull each other's changes.

Another thing to look at is simplified branching for bugfix branches:

Start with a release: 3.0.8. Then, after that release, do this:

git branch bugfixes308

This will create a branch for bugfixes. Checkout the branch:

git checkout bugfixes308

Now make any bugfix changes you want.

git commit -a

Commit them, and switch back to the master branch:

git checkout master

Then pull in those changes from the other branch:

git merge bugfixes308

That way, you have a separate release-specific bugfix branch, but you're still pulling the bugfix changes into your main dev trunk.

这篇关于修订号码的Git等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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