与SVN相比,Git如何处理分支? [英] How does Git handle branches compared to SVN?

查看:95
本文介绍了与SVN相比,Git如何处理分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相对简单的问题,但是我在互联网上找不到很多。我所有的搜索结果仅显示了如何使用git分支,但没有说明它的不同之处。

Relatively simple question but I can't find much on the internet. All my search results simply show how to use git branches but doesn't explain how its different.

我知道,使用SVN,创建主干的新分支意味着将主干的完整副本复制到分支目录中,我也知道Git不会像SVN那样创建全副本-那么它有什么作用?

I know that with SVN, creating a new branch of the trunk means to create a full copy of the trunk, into the 'branches' directory, and I also know that Git does not create full copy like SVN - so what does it do? This is more for writing facts in my DVCS research documentation rather than anything.

也许与SVN相比,git的标签处理方式可能是对此的扩展?

Perhaps an extension to this would be how git handles tags as compared to SVN?

预先感谢。

推荐答案

在git中,分支只是指向特定修订版本的指针。在任何时候,您都可以返回任何旧版本( git checkout [修订版] ),将另一个分支指向该版本( git checkout -b new -branch ),然后从该点开始工作。

In git, a branch is a just a pointer to a certain revision. At any point, you can go back to any old revision (git checkout [revision]), point another branch at it (git checkout -b new-branch), and start working from that point onwards.

您可以使用 gitk 命令浏览分支树,然后可以通过右键单击修订版等来创建分支。此工具通常有助于使幕后工作变得更加清晰。 (如果您使用的是Mac OS,那么还有 gitx ,我不能没有)

You can use the gitk command to browse the tree of branches, and you can create branches by right clicking on revisions etc. This tool often helps make what is going on under the hood clearer. (If you are on Mac OS, there is also gitx, which I can't live without)

这篇关于与SVN相比,Git如何处理分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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