diff --git a/content/github/administering-a-repository/changing-the-default-branch.md b/content/github/administering-a-repository/changing-the-default-branch.md index ad377044d76f..7e1a1c11352c 100644 --- a/content/github/administering-a-repository/changing-the-default-branch.md +++ b/content/github/administering-a-repository/changing-the-default-branch.md @@ -16,7 +16,7 @@ You can choose the default branch for a repository. The default branch is the ba {% note %} -**Note**: If you use the Git-Subversion bridge, setting a different default branch will affect your `trunk` branch contents and the `HEAD` you see when you list references for the remote repository. For more information, see "[Support for Subversion clients](/github/importing-your-projects-to-github/support-for-subversion-clients)" and [git-ls-remote](https://git-scm.com/docs/git-ls-remote.html) in the Git documentation. +**Note**: If you use the Git-Subversion bridge, changing the default branch will affect your `trunk` branch contents and the `HEAD` you see when you list references for the remote repository. For more information, see "[Support for Subversion clients](/github/importing-your-projects-to-github/support-for-subversion-clients)" and [git-ls-remote](https://git-scm.com/docs/git-ls-remote.html) in the Git documentation. {% endnote %} @@ -51,8 +51,8 @@ To change the default branch, your repository must have more than one branch. Fo {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.repository-branches %} -4. In the default branch drop-down, choose the new default branch. +1. In the default branch drop-down, choose the new default branch. ![Default branch dropdown selector](/assets/images/help/repository/repository-options-defaultbranch.png) -5. Click **Update**. +1. Click **Update**. {% endif %} diff --git a/script/anonymize-branch.js b/script/anonymize-branch.js new file mode 100755 index 000000000000..e5da59f3d46a --- /dev/null +++ b/script/anonymize-branch.js @@ -0,0 +1,29 @@ +#!/usr/bin/env node + +// [start-readme] +// +// Flatten all the commits in the current branch into a single anonymized @Octomerger commit +// +// Usage: script/anonymize-branch.js [base-branch] +// Example: script/anonymize-branch.js "nothing to see here" +// If the optional [base-branch] argument is omitted, it will default to `main` +// +// [end-readme] + +process.env.GIT_AUTHOR_NAME = process.env.GIT_COMMITTER_NAME = 'Octomerger Bot' +process.env.GIT_AUTHOR_EMAIL = process.env.GIT_COMMITTER_EMAIL = '63058869+Octomerger@users.noreply.github.com' + +const { execSync: exec } = require('child_process') +const path = require('path') +const args = process.argv.slice(2) +const message = args[0] +const base = args[1] || 'main' + +if (!message || !message.length) { + console.error(`Specify a new commit message in quotes. Example:\n\nscript/${path.basename(module.filename)} "new commit"`) + process.exit() +} + +exec(`git reset $(git merge-base ${base} HEAD)`) +exec('git add -A') +exec(`git commit -m "${message}"`)