SVN 到 Git 分支/标签/主干

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13141871/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:41:57  来源:igfitidea点击:

SVN to Git Branch/Tag/Trunk

gitsvntagsbranchtrunk

提问by Oliver Spryn

I am making the leap from SVN to Git (though, my respect for SVN will still hold) and I had a few questions for some SVN to Git terminology. In SVN, many repositories are setup like this:

我正在从 SVN 飞跃到 Git(不过,我对 SVN 的尊重仍然存在)并且我对一些 SVN 到 Git 的术语有一些疑问。在 SVN 中,许多存储库是这样设置的:

- trunk  : The place where all of the main development occurs
- tag    : Storing versions of major releases or important milestones
- branch : Where smaller "branch" development occurs as to not conflict with the main development occurring in the trunk, then is later merged into the trunk

What are the standard convention names for branch/tag/trunkin Git?

branch/tag/trunkGit中的标准约定名称是什么?

Thank you for your time.

感谢您的时间。

采纳答案by Nicoretti

Git does not force you to use a specific structure for your project. All information which is important for git itself will be stored in the hidden .git directory. To list or see you branches and tags use the git commands:

Git 不会强制您为您的项目使用特定的结构。所有对 git 本身很重要的信息都将存储在隐藏的 .git 目录中。要列出或查看您的分支和标签,请使用 git 命令:

git branch 
git tag
...

to get further information use the git helpcommand or have a look at this free book

要获取更多信息,请使用git help命令或查看这本免费书籍

回答by Dmitry Pavlenko

  • SVN trunk --- Git master (refs/heads/master)
  • SVN branches/* --- Git branches (refs/heads/*)
  • SVN tags/* --- Git tags (refs/tags/*)
  • SVN 主干 --- Git master (refs/heads/master)
  • SVN 分支/* --- Git 分支(refs/heads/*)
  • SVN 标签/* --- Git 标签(参考/标签/*)

回答by prodigitalson

There aren't any direct analogues really. SVN uses a directory structure to store copies directly in the repository to allow for branches and tags. Therefore there is concept in creating a structure to hold these copies in the repository.

真的没有任何直接的类似物。SVN 使用目录结构将副本直接存储在存储库中,以允许分支和标签。因此,创建一个结构以在存储库中保存这些副本是有概念的。

Git on the other hand maintains this as meta information and treats everything as a snapshot of a point in "time" as identified by a hash:

另一方面,Git 将其作为元信息进行维护,并将所有内容视为由哈希标识的“时间”点的快照:

Subversion marks certain checkpoints in history through copies, the copy is usually placed in a directory named tags. Git tags are much more powerful. The Git tag can have an arbitrary description attached (the first line is special as in the commit case), some people actually store the whole release announcements in the tag descriptions. The identity of the person who tagged is stored (again following the same rules as identity of the committer). You can tag other objects than commits (but that is conceptually rather low-level operation). And the tag can be cryptographically PGP signed to verify the identity (by Git's nature of working, that signature also confirms the validity of the associated revision, its history and tree).

Subversion 通过副本标记历史中的某些检查点,副本通常放置在名为 tags 的目录中。Git 标签更强大。Git 标签可以附加任意描述(第一行在提交情况下很特殊),有些人实际上将整个发布公告存储在标签描述中。存储标记者的身份(再次遵循与提交者身份相同的规则)。您可以标记提交以外的其他对象(但这在概念上是相当低级的操作)。并且可以对标签进行加密 PGP 签名以验证身份(根据 Git 的工作性质,该签名还确认相关修订、其历史记录和树的有效性)。

So basically there is no "repository structure"; there is only the project structure (ie. what you would find in trunk, a branch, or a tag in your SVN repo)

所以基本上没有“存储库结构”;只有项目结构(即您会trunk在 SVN 存储库中找到的内容、分支或标签)