Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow people to use master as an alias for devel in git #43

Closed
abadger opened this issue Dec 12, 2016 · 13 comments
Closed

Allow people to use master as an alias for devel in git #43

abadger opened this issue Dec 12, 2016 · 13 comments
Labels

Comments

@abadger
Copy link
Contributor

abadger commented Dec 12, 2016

Proposal: Allow people to use master as an alias for devel in git

Date: 2016/12/12

  • Status: New
  • Proposal type: process
  • Targeted Release: git repo, 2.3
  • Associated PR: <link to GH PR in ansible/proposals if PR was submitted>
  • Estimated time to implement: 5 minutes + 1 hour of testing

Motivation

Many git projects use master to mean their default trunk branch. Ansible uses devel for historical reasons. This confuses other users

Solution proposal

  • @dagwieers Found that git has a way to make aliases between branch names

BTW this works: git symbolic-ref -m "Add compatibility for people used to a default master branch" master refs/heads/devel

So the solution proposed is to run:

git symbolic-ref -m "Add compatibility for people used to a default master branch" master refs/heads/devel

Testing (optional)

Make a new local copy of the repository and then run git symbolic-ref -m "Add compatibility for people used to a default master branch" master refs/heads/devel

Then test:

  • git clone of the repo
  • git checkout master
  • git commit && git push
  • git checkout devel
  • git commit && git push
  • Make sure that both commits are reflected back into the original local repository.
@mscherer
Copy link
Contributor

I am +1 on that, that's already what I do, but I didn't realise this could be done on the repo directly.

@dagwieers
Copy link
Contributor

dagwieers commented Dec 12, 2016

@abadger I did some more research, and learned that while this is "technically" possible, Git does not allow to push symbolic references. GitHub does allow to update the HEAD symbolic reference (by means of changing the default branch) but has no means of adding other symbolic references.

Once set though, others can pull them (like normal branches etc.) so the limitation here is GitHub (or the Git protocol if you like).

http://git.661346.n2.nabble.com/Pushing-symbolic-references-to-remote-repositories-td7573536.html
http://stackoverflow.com/questions/847609/create-a-git-symbolic-ref-in-remote-repository

For GitLab there is a feature-request to allow for this:

https://gitlab.com/gitlab-org/gitlab-ce/issues/20370

@bcoca
Copy link
Member

bcoca commented Dec 12, 2016

So will that make PRs harder? if someone pushes one to /master but we need to merge it into /devel ?

@dagwieers
Copy link
Contributor

dagwieers commented Dec 12, 2016

@bcoca How it is now working on my system, if you checkout master, it is devel for git.

[dag@moria ansible.dag]$ git checkout master
Switched to branch 'master'
[dag@moria ansible.dag]$ git status
# On branch devel
nothing to commit (working directory clean)

What I did for this was actually:

[dag@moria ansible.dag]$ git symbolic-ref -m "Add compatibility for people used to a default master branch" refs/heads/master refs/heads/devel

And for Git

[dag@moria ansible.dag]$ git show-ref --heads -d master devel
4b9a65fd7c443716553a2d04b2e80a73b4b76e8c refs/heads/devel
4b9a65fd7c443716553a2d04b2e80a73b4b76e8c refs/heads/master
[dag@moria ansible.dag]$ tail .git/refs/heads/{devel,master}
==> .git/refs/heads/devel <==
4b9a65fd7c443716553a2d04b2e80a73b4b76e8c

==> .git/refs/heads/master <==
ref: refs/heads/devel

So while it looks as if both branches simply reference the same commit, in practice one points to the other as if it were the same branch.

@dagwieers
Copy link
Contributor

And to proof that this works in Git itself, that's how the default branch is being selected:

[dag@moria ansible.dag]$ cat .git/refs/remotes/origin/HEAD 
ref: refs/remotes/origin/devel

@bcoca
Copy link
Member

bcoca commented Dec 12, 2016

nice, if it is transparent i have no opposition

I don't get the 'difficulty' of not having a 'master', but if people really want it....

@dminca
Copy link

dminca commented Dec 14, 2016

haha and when I suggested this on IRC someone yelled at me if that's how you use it, doesn't mean we have to use it too lol

@dagwieers
Copy link
Contributor

dagwieers commented Dec 14, 2016

@dminca I think it is important to use (or abide) to standard practices, where possible. I would prefer the default branch is called master, but if there is a solution that allows both, why not do that. Unfortunately it seems GitHub at this time does not allow us to do this through their Web-interface. However, maybe there is another way to do this on GitHub, I don't know yet.

https://www.spinics.net/lists/git/msg195321.html

@alikins
Copy link

alikins commented Dec 15, 2016

Some notes from irc core meeting 2016-12-15

<bcoca> the only issue i see with that is the initial reasons we had for not issuing a master/ ... so 
people would not consider it stable
<bcoca> that is why we have stable branches and push primarily against /devel
<bcoca> i persontally dont care either way
<agaffney> people already clone the git repo and pay no attention to the branch name and then complain
 that things are broken
<ryansb> If it wouldn't change our process, I don't see a benefit
<alikins> Seems reasonable to me. I guess https://github.com/ansible/proposals/issues/43#issuecomment-267122340 is kind of an issue  (if we can
 do this for the github repo)
<bcoca> people will be confused by this no matter what we do ... also if this is biggest issue we have left
 in ansible ... i would be joyful
<nitzmahone> Curious how the alias would interact with GH protected branches if we need to lock things
 down...
<agaffney> I can understand *why* this was requested, but I think it would probably be more trouble than
 its worth
* nitzmahone would tend to agree
<ryansb> it would just be *more* confusing because then we'd need to keep both in sync etc
<bcoca> if github interactions are not clear, we should defer any decisions until we know
<bcoca> cannot decide w/o knowing full consequences ... its not like im POTUS
<agaffney> needs more twitter rants
<bcoca> agaffney: as author, object or bystander?
* allanice001 votes for master == stable
<alikins> main utility to me is to make random git tools that assume 'master' work by default. Also no
 master is kind of a unnecessary unexpected behavior without much utility aside being status quo.
<bcoca> im fine if it does not affect current workflow, but we cannot make a decision when we don't know
 the consequences on the github side, i would defer this to next meeting and have someone investigate
 the interatcions
<nitzmahone> Master as current stable would likely cause even more problems, since we rarely want
 direct commits to stable.
<alikins> #info https://github.com/ansible/proposals/issues/43#issuecomment-267122340  
Unclear if github supports the branch alias
<bcoca> so any discussion now is not that useful until we KNOW
<alikins> #info <nitzmahone> Curious how the alias would interact with GH protected branches if we need
 to lock things down...
<alikins> #action Figure out if this works on github.  dag, bcoca, abadger1999 
<alikins> I'd say that topic is covered for now.
<alikins> Next topic?

@dminca
Copy link

dminca commented Dec 15, 2016

I couldn't agree more @dagwieers, since git was designed, the master branch was used by many as continuous trunk of development. When you want to release, you branch off for that release.

@gundalow
Copy link
Contributor

This still needs doing:

#action Figure out if this works on github. dag, bcoca, abadger1999

@gundalow
Copy link
Contributor

Also we need to know what the real benefits are

@gundalow
Copy link
Contributor

Jimi-C said no

Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants