是否有可能在Git中创建分支? [英] Is it possible to alias a branch in Git?

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

问题描述

我正在研究大规模使用git。我希望通过调用主分支中继来提高采用率并使事情更轻松。

这可能会给SVN用户带来一些舒适感。我知道我可以创建一个名为trunk的分支,但似乎偏离了git规范,可能会导致一些用户感到困惑。

我知道我也可以创建和删除标签,但是当我签出这些标签时,它告诉我这是一个非本地分支,这对我来说很好但可能不是我想要做的。

我是git newb,但是在发布和构建系统方面经验丰富。

我想要做的就是能够调用master trunk。我已经看到了别名命令的功能,这是否适用于名称版本化的对象呢?



我知道git-svn的存在和其他工具,但是分层存储库系统的开销让我感到担忧。

解决方案

您可以按照Greg的建议重新命名主分支中继,或者也可以创建一个主分支,这是对主分支的符号引用,以便git和svn用户都拥有'main'分支它们是习惯的。

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

请注意,后备箱不是头等公民。如果您签出 trunk 并执行 git status ,您将实际上位于 master ,但是您可以在所有使用分支名称(log,merge等)的地方使用 trunk 命令。


I am looking into using git on a massive scale. I was hoping to increase adoption and make things easier by calling the master branch trunk.

This can and will give SVN users some feelings of comfort. I know I can create a branch called trunk but that seems to deviate from the git norms and might cause some users to get confused.

I know that I can also create and delete tags to my heart's content but when I checkout those tags it tells me it is a non local branch which is just fine with me but probably not what I want to be doing.

I am a total git newb but a seasoned professional at release and build systems.

What I want to do is to be able to call master trunk. I have seen the ability to alias commands does this apply for the names of versioned objects as well?

I know git-svn exists and other tools but the overhead of layered repository systems frightens me.

解决方案

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中创建分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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