3 ms·
I use this alias all the time, "Make PR" which creates a draft PR from the current branch and opens your browser to it. Assumes macOS + the GitHub CLI is instal
by user3939382 5y ago
I use this alias all the time, "Make PR" which creates a draft PR from the current branch and opens your browser to it. Assumes macOS + the GitHub CLI is installed:
alias mkpr='git push && gh pr create -d -f -B develop | grep https | xargs printf -- '%s/files' | xargs open'
Or "merge develop upstream changes":
alias mduc='CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) && git checkout develop && git pull && git pull --tags && git checkout ${CURRENT_BRANCH} && git merge develop'
Or, "Git add and commit" -- add all changes and a commit message like "Foo bar" in one step like "$gac Foo bar"
function gac ()
{
git add-commit -m "$\*"
}
Which assumes this git alias
add-commit = !git add -A && git commit
- ajgrover 5y ago“gh pr create” automatically pushes branches I believe. There’s also a “—-web” option which opens the browser automatically. A couple extra clicks to actually open the draft PR but quite a bit simpler IMO
- dlvhdr 5y agoYeah I use gh pr open —web
- user3939382 5y agoI believe that would open a non-draft PR (which for me gets announced on Slack which I don’t want) unless you enter flags which I don’t want for daily commands, opens it against the wrong (master) branch in my case, and takes me to the wrong page (convo/main) whereas I want to see files. It’s not a bad alternative.
- jakub_g 5y agoSame issue with Slack. IMO the PRs should be by default opened as drafts, or at least there should be a per repo or per user option to enforce that. Often someone opens a nonreviewable WIP, or messes up something with branches, and dozens of codeowners get pinged to review a diff of something that was already merged. Also even if initial PR is flawless, it doesn't hurt for the opener to take a deep breath and self-review it before notifying everyone.