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

Change the default branch from "master" to something else #929

Closed
6 tasks done
mislav opened this issue May 15, 2020 · 7 comments
Closed
6 tasks done

Change the default branch from "master" to something else #929

mislav opened this issue May 15, 2020 · 7 comments
Assignees

Comments

@mislav
Copy link
Contributor

mislav commented May 15, 2020

Our team would prefer to change our default branch name away from "master", since "master" is a generally problematic term due to its association with slavery in some contexts. (We are aware that "master" as used in git does not necessarily have that connotation, but we do not want to nitpick about etymology here.)

We are considering one of these names for the default branch name: trunk, development, or main.

TODO:

  • check our scripts/automation for whether master is hardcoded anywhere
  • run the branch migration script (below)
  • move branch protections from master to new branch
  • modify docs to reference the new branch instead of master
  • delete master branch
  • instruct devs to update their local clones:
    git fetch origin --prune
    git checkout trunk
    git remote set-head origin trunk
    git branch -D master
    

Ref. desktop/desktop#6478

@mislav
Copy link
Contributor Author

mislav commented May 15, 2020

(Untested) script to change the default branch from the command-line using gh:

set -e

repo=cli/cli
newbranch=trunk
remote=origin

git fetch "$remote" master
git checkout -b "$newbranch" "${remote}/master" --no-track
git push -u "$remote" "$newbranch"
git remote set-head "$remote" "$newbranch"

# update the default branch
gh api -XPATCH "repos/${repo}" -f default_branch="$newbranch" >/dev/null

# update the base branch of all open pull requests
for num in `gh pr list -B master -L999 | awk '{print $1}'`; do
  gh api -XPATCH "repos/${repo}/pulls/${num}" -f base="$newbranch" >/dev/null
done

Ref. #909

@nerdneha
Copy link
Contributor

Update! We'll be changing our default branch name to: trunk! 🥳

@tierninho
Copy link
Contributor

tierninho commented May 18, 2020

Adding a small task for me to update the soon-to-be broken links in our issues as they would still point to master:

@mislav
Copy link
Contributor Author

mislav commented May 27, 2020

This is done! The default branch is now trunk

@mislav mislav closed this as completed May 27, 2020
@Phinome

This comment has been minimized.

@kucukkanat

This comment has been minimized.

@cli cli locked as resolved and limited conversation to collaborators Jun 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@mislav @kucukkanat @nerdneha @Phinome @tierninho and others