Skip to content

Commit

Permalink
Merge pull request github#175 from github/repo-sync
Browse files Browse the repository at this point in the history
repo sync
  • Loading branch information
Octomerger authored Oct 7, 2020
2 parents f4599bf + 97b949a commit 16c954d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down Expand Up @@ -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 %}
29 changes: 29 additions & 0 deletions script/anonymize-branch.js
Original file line number Diff line number Diff line change
@@ -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 <new-commit-message> [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}"`)

0 comments on commit 16c954d

Please sign in to comment.