创建分支别名? [英] Create a branch alias?

查看:22
本文介绍了创建分支别名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究从星际团队切换到 Git.

I am researching switching from starteam to Git.

目前,在 Starteam 中,我们使用浮动视图";带有特殊名称.这些浮动视图基本上像别名一样工作.因此,我们可以指定一个特定的别名进行结账,我们将获得我们当前正在模型测试的分支.

Currently, in starteam, we use "floating views" with special names. These floating views basically work like aliases. Therefore, we can specify a specific alias to checkout from and we'll get the branch that we're currently model testing.

这将如何在 Git 中完成?我们的分支机构基本上是这样组织的:

How would this be done in Git? This is basically how our branches are organized:

这些都是分支

master (stable view)
   |  - Branch 2012.05.01
   |          | - Project 1
   |          | - Project 2
   |          | - model [floating view / alias to Branch 2012.05.01]
   |
   |  - Branch 2012.07.11   (these would also have various child views for projects)
   |  - Branch 2012.10.17

(当模型测试完成时,Branch 2012.05.01 将合并到master.)

(Branch 2012.05.01 would be merged to master when model testing is complete.)

在我们的自动化脚本 (ant) 中,为了运行我们的模型部署,我们只需从名为 model 的分支中检出.这样我们就不必在更改模型测试的分支时更改脚本,并且找出我们正在模型测试的视图就像找出 model 分支引用的分支一样简单.

In our automated scripts (ant), to run our model deployment, we just checkout from our branch called model. This way we never have to change our scripts as we change which branch we are model testing, and finding out which view we're model testing is as easy as figuring out which branch the model branch references.

有没有这样的方式在 Git 中做类似的事情?

Is there any such way to do something similar in Git?

澄清:

  1. 我想要一个分支的别名.一个分支,而不是一次提交.
  2. Branch 2012.05.01 是指打算在 2012.05.01 发布的分支,而不是 2012.05.01 时刻.
  3. 我想要Branch 2012.05.01 的别名.Branch 2012.05.01 是一个集成分支,不断修改.但我不想将其引用为 Branch 2012.05.01,我想将其引用为 model.这样,我可以将别名更改为 Branch 2012.07.11,它将从该分支获取最新代码,而无需更改任何结帐代码脚本.
  1. I want an alias of a branch. A branch, not a commit.
  2. Branch 2012.05.01 means the branch intended to be shipped on 2012.05.01, it doesn't mean a 2012.05.01 moment in time.
  3. I want an alias to Branch 2012.05.01. Branch 2012.05.01 is an integration branch, it's constantly modified. But I don't want to reference it as Branch 2012.05.01, I want to reference it as model. This way, I can change my the alias to Branch 2012.07.11 and it will get the most recent code from that branch without changing any of the checkout code script.

推荐答案

请看这里:https://stackoverflow.com/a/549949/606723

您可以按照 Greg 的建议重命名主分支主干,或者您也可以创建一个主干,作为对主人的象征性引用分支以便 git 和 svn 用户都拥有他们的主"分支习惯了.

You can rename the master branch trunk as Greg has suggested, or you can also create a trunk that is a symbolic reference to the master branch so that both git and svn users have the 'main' branch that they are used to.

git symbolic-ref refs/heads/trunk refs/heads/master

请注意,trunk 不是一等公民.如果您结帐行李箱和执行 git status 你实际上是在 master 上,但是你可以在所有使用分支名称(日志、合并等).

Note that trunk isn't a first class citizen. If you checkout trunk and perform a git status you will actually be on master, however you can use the trunk command in all places that you use the branch name (log, merge, etc.).

这篇关于创建分支别名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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