GNU/Linux xterm-256color zsh 469 views

Describe the feature or problem you’d like to solve It takes at least three to five steps to rename the default branch of a repo. Some in the CLI and one that most users would use the GitHub UI for. But as I found the other day a few will find the a less documented CLI path for:

gh api -XPATCH “repos/:owner/:repo” -f default_branch=”$newbranch” >/dev/null This process isn’t new. There are blogs and gists all over.

https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx https://gist.github.com/mislav/5ac69530acbe1b4ca909e272caabfdba All of this requires a lot from users: To search docs, download scripts, etc. Doing the right thing should be easier. I know GitHub is already working on a number of these changes internally. This just seems like another easy way to get something out that would have an impact quickly.

Proposed solution My proposal is to add a one stop shop for a rename tool. You already have a GitHub account if you’re using gh. There are a lot of repos out there to update. GitHub wants folks to use their new CLI. Here’s a good reason to download it. Make your life easier and the lives of others better.

Additional context I wanted to implement this to help me get through the repos I use. So I implemented something in my own fork. I used gh repo update though that probably isn’t what yall would want to do. I wasn’t sure where it would fit. Its not a simple update since it also does alter the local repo vs say just toggle the wiki or alter the description.

metcalfc@8b7cd75

There is a asciicast of the workflow here: https://asciinema.org/a/339953

More recordings by metcalfc