git - 创建分支别名?

标签 git version-control branching-and-merging feature-branch

<分区>

我正在研究从 starteam 切换到 Git。

目前,在 starteam 中,我们使用具有特殊名称的“ float View ”。这些 float View 基本上就像别名一样工作。因此,我们可以指定一个特定的别名来从中 check out ,我们将获得我们当前正在进行模型测试的分支。

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

这些都是分支

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会在模型测试完成后 merge 到master。)

在我们的自动化脚本 (ant) 中,为了运行我们的模型部署,我们只需从名为 model 的分支中 check out 。这样,我们永远不必在更改我们正在对哪个分支进行模型测试时更改脚本,并且找出我们正在对哪个 View 进行模型测试就像找出 model 分支引用的分支一样简单。

在 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,它将从该分支获取最新代码,而无需更改任何 checkout 代码脚本。

最佳答案

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

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

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.).

关于git - 创建分支别名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14365946/

相关文章:

Git:拒绝通过推送删除远程分支(如 receive.denyDeletes),但前提是分支未完全 merge

git describe --tags 不适用于 Jenkins 管道构建

Git fork 工作流程, Remote 的名称是什么?

sql-server - 经常使用模式绑定(bind)和更新时如何处理数据库模式更新

javascript - 使用旧版本 jQuery 的原因?

branching-and-merging - 在 PlasticSCM 中,如何重新设置分支的父级?

git - 切换 svn 分支 git dcommits 到

git - 启动 gitk 错误

GitLab CI GIT STRATEGY=克隆作业不起作用

git - "git checkout -- *"返回 "error: pathspec did not match any files known to git"