-
-
Save jaffarc/afa7ababd13282a0c17360c10882ca9e to your computer and use it in GitHub Desktop.
Revisions
-
mislav revised this gist
Jun 12, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ git remote set-head "$remote" "$newbranch" gh api -XPATCH "repos/:owner/: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 | cut -f1`; do gh api -XPATCH "repos/:owner/:repo/pulls/${num}" -f base="$newbranch" >/dev/null echo -n . done -
mislav revised this gist
Jun 12, 2020 . No changes.There are no files selected for viewing
-
mislav revised this gist
Jun 12, 2020 . No changes.There are no files selected for viewing
-
mislav created this gist
Jun 12, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/bin/bash # Usage: gh-rename-master <newbranch> [<remote>] # # Renames the "master" branch of the current repository both locally and on GitHub. # # dependencies: GitHub CLI v0.10 set -e newbranch="${1?}" remote="${2:-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/:owner/: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/:owner/:repo/pulls/${num}" -f base="$newbranch" >/dev/null echo -n . done printf '\nDone!\n'