views:

484

answers:

2

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.

+1  A: 

There is nothing special about the name "master" in Git, it's just called that by convention (and by default). You can certainly call it "trunk" if you like:

git branch -m master trunk

This is very much like Subversion, where the name "trunk" is only called that by convention too. You could have called the main branch "master" in Subversion.

Greg Hewgill
Without knowing your new convention would new pullers not know where to start?
ojblass
The HEAD of the common repository would point to "trunk", so pullers wouldn't have to know.
Greg Hewgill
+6  A: 

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

Charles Bailey
Serving both types of users is my main concern. Is doing this on the server sufficient for the alias really to be completely visible? I would vote you up by I don't have the cred for it yet.
ojblass
Yes, it is. When users git fetch, they'll see a remote ref for both origin/master and origin/trunk. It won't necessarily be obvious from the fetch that they are the same thing, but when anyone pushes to either master or trunk then both branches will 'magically' be updated together.
Charles Bailey
I don't think symrefs transfer to clone if one use git:// or ssh protocol - you better check it.
Jakub Narębski
I don't think they do, either, they just turn into normal remote refs, but they both still track the symref-ed central branch so in a way (perhaps) it doesn't matter. One difference I can think of is that you will have to fetch after pushing to notice that the other remote branch moved as well.
Charles Bailey