# Renaming master to main -- Julia-specific experience

**URL:** <https://discourse.julialang.org/t/renaming-master-to-main-julia-specific-experience/57723>\
**Category:** Package Management\
**Tags:** github, registry\
**Created:** [March 22, 2021, 3:09pm UTC](https://discourse.julialang.org/t/renaming-master-to-main-julia-specific-experience/57723 "2021-03-22T15:09:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fonsp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fonsp/32/222349_2.png) [@fonsp](https://discourse.julialang.org/u/fonsp)\
**Post date:** [March 22, 2021, 3:09pm UTC](https://discourse.julialang.org/t/renaming-master-to-main-julia-specific-experience/57723/1 "2021-03-22T15:09:03Z")

</div>

For package maintainers considering renaming their default branch from master to main: I did it last month (Pluto.jl and PlutoUI.jl), and **here are my Julia-specific experiences**!

> The main takeaway for me was: **the rename was very easy, I was more worried about it than necessary!**

GitHub already has multiple tools to make the transition easier, which is really helpful! I recommend [renaming your branch using the github.com web interface](https://docs.github.com/en/github/administering-a-repository/renaming-a-branch).

## GitHub in general

The full list of github features to support the rename is [here](https://github.com/github/renaming), my highlights are:

- Open pull requests will automatically get ‘redirected’ into `main`.
- Contributors will see a helpful popup the next time they visit the repository.

* * *

## Julia-specific experiences

- 💜 **JuliaRegistrator** will work seamlessly after the rename. _(In fact, you can trigger `@JuliaRegistrator` on any commit, regardless of its branch.)_

- 💜 **TagBot** will work seamlessly after the rename.

- 💜 **Test actions** will work seamlessly after the rename, unless the branch name `master` is ‘hardcoded’ in your `.github/workflows/Test.yml` file, simply edit the file to fix it.

- 💜 **Old registered versions** will continue to be available.

- 🙋 **Links** inside code – I recommend searching your codebase for `yourname/Package.jl/tree/master` to find any links in comments or documentation that might need to be changed.

If you are using `mybinder.org`, then

- 🙋 **Old [mybinder.org](http://mybinder.org)** links that used a commit tag will work! But mybinder links that still point to `master` **will not work** , and will [show an error message](https://user-images.githubusercontent.com/6933510/112010109-4c003700-8b27-11eb-81f7-fbdd2e6c666d.png) asking the visitor to change `master` to `main` in the URL.  
Use the [link generation tool](https://mybinder.org/) to get a new link.

Feel free to reply or contact me personally if I missed something in the list!

---

<div class="post-metadata">

**Author:** ![fonsp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fonsp/32/222349_2.png) [@fonsp](https://discourse.julialang.org/u/fonsp)\
**Post date:** [March 22, 2021, 3:09pm UTC](https://discourse.julialang.org/t/renaming-master-to-main-julia-specific-experience/57723/2 "2021-03-22T15:09:11Z")

</div>

## Updating your local clone

After renaming the default branch on [github.com](http://github.com), you have to update your local clone to match these changes.

GitHub will give you the commands to type to do so, which look something like:

```julia-auto
# don't copy me, get the instructions provided by github for your own repository
git branch -m master main
git fetch origin
git branch -u origin/main main

```

But as an even simpler solution, I recommend **simply deleting the folder from your computer** (after committing all your changes!), and then cloning again.

### GitHub Desktop

If you’re like me, and you prefer not to use the `git` command line, here are the instructions for GitHub Desktop users:

1. click Fetch,
2. check out the `main` branch (you might need to search), bring over your changes if any
3. restart github desktop for the default branch to get corrected

The `master` branch will still exist locally, you can clean it up like so:

1. check out the `master` branch
2. Go to Branch \> Delete Branch \> Cannot be undone – yes I am sure.

Again, you can also just **delete the folder and clone again**.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 22, 2021, 4:07pm UTC](https://discourse.julialang.org/t/renaming-master-to-main-julia-specific-experience/57723/3 "2021-03-22T16:07:34Z")

</div>

> [@fonsp](#):
>
> considering renaming their default branch from master to main

Can you please explain why one would do this?

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [March 22, 2021, 4:19pm UTC](https://discourse.julialang.org/t/renaming-master-to-main-julia-specific-experience/57723/4 "2021-03-22T16:19:36Z")

</div>

The word is overloaded with history, especially when it comes from a tradition of master/slave terminology. To me, I also find `main` to be a better word in the first place given how we use git.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [March 22, 2021, 4:27pm UTC](https://discourse.julialang.org/t/renaming-master-to-main-julia-specific-experience/57723/5 "2021-03-22T16:27:04Z")

</div>

I believe it will eventually be replaced as the default branch name on all new repositories. (I could be making that up though, can’t quite remember)

So could make sense to backport the change so that default branch is always `main`

---

<div class="post-metadata">

**Author:** ![Satvik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/satvik/32/20486_2.png) [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Post date:** [March 22, 2021, 4:39pm UTC](https://discourse.julialang.org/t/renaming-master-to-main-julia-specific-experience/57723/6 "2021-03-22T16:39:24Z")

</div>

It already has been! I made some new github repos recently and they all used `main` by default.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [March 22, 2021, 5:29pm UTC](https://discourse.julialang.org/t/renaming-master-to-main-julia-specific-experience/57723/7 "2021-03-22T17:29:15Z")

</div>

Same for Gitlab and Bitbucket. Also many big tech companies are moving away from using `master` as the default branch name. It’s probably going to be an industry-wide change.

It seems likely that at some point the Julia project will have to consider this issue as well.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [March 22, 2021, 5:46pm UTC](https://discourse.julialang.org/t/renaming-master-to-main-julia-specific-experience/57723/8 "2021-03-22T17:46:53Z")

</div>

One thing related to this that recently bit me was when I wanted to use the latest version of DataFrames, and out of habit/muscle memory did `add DataFrames#master`, which worked, but installed an old version as the `master` branch was still around from before the switch.

Not sure whether this is always the best course of action but removing the `master` branch entirely would prevent this (in the DataFrames case I think there was a specific reason to keep that branch, so this might not always be possible).

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 23, 2021, 6:16am UTC](https://discourse.julialang.org/t/renaming-master-to-main-julia-specific-experience/57723/9 "2021-03-23T06:16:23Z")

</div>

Thanks, I knew about the master/slave issue, but wasn’t aware that master in itself is controversial.
