Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
902 views
in Technique[技术] by (71.8m points)

version control - Is it possible to alias a branch in Git?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...