是否可以从终端而不是网站在github中创建pull请求

是否可以从终端而不是网站在github中创建pull请求,git,terminal,pull-request,Git,Terminal,Pull Request,我想直接从终端创建pull请求 我只想发出一些命令,比如: git pull-create-pull-request localBranch git@github.com:user/repo originBranch 看看github的命令。如果按照文档中的说明进行安装,则可以通过运行以下命令打开拉取请求: git pull-request 基于Paul Irish的,我创建了一个git create pr脚本,可以从当前签出的分支创建一个GitHub pr 请注意,这对我的工作流程很有效,

我想直接从终端创建pull请求

我只想发出一些命令,比如:

git pull-create-pull-request localBranch git@github.com:user/repo originBranch
看看github的命令。如果按照文档中的说明进行安装,则可以通过运行以下命令打开拉取请求:

git pull-request
基于Paul Irish的,我创建了一个
git create pr
脚本,可以从当前签出的分支创建一个GitHub pr

请注意,这对我的工作流程很有效,一些同事也使用过它,但它可能包含bug

#!/usr/bin/env bash

# Opens the "Open Pull Request" GitHub page for a repo/branch in your browser.
# based on git-open by Paul Irish (https://github.com/paulirish/git-open/)
#
# git create-pr
# git create-pr [remote] [branch]

# are we in a git repo?
git rev-parse --is-inside-work-tree &>/dev/null

if [[ $? != 0 ]]; then
  echo "Not a git repository." 1>&2
  exit 1
fi


# assume origin if not provided
# fallback to upstream if neither is present.
remote="origin"
if [ -n "$1" ]; then
  if [ "$1" == "issue" ]; then
    currentBranch=$(git symbolic-ref -q --short HEAD)
    regex='^issue'
    if [[ $currentBranch =~ $regex ]]; then
      issue=${currentBranch#*#}
    else
      echo "'git open issue' expect branch naming to be issues/#123" 1>&2
      exit 1
    fi
  else
    remote="$1"
  fi
fi

remote_url="remote.${remote}.url"

giturl=$(git config --get "$remote_url")
if [ -z "$giturl" ]; then
  echo "$remote_url not set." 1>&2
  exit 1
fi

# get current branch
if [ -z "$2" ]; then
  branch=$(git symbolic-ref -q --short HEAD)
else
  branch="$2"
fi

# Make # and % characters url friendly
#   github.com/paulirish/git-open/pull/24
branch=${branch//%/%25} && branch=${branch//#/%23}

# URL normalization
# GitHub
giturl=${giturl/git\@github\.com\:/https://github.com/}

# handle SSH protocol (links like ssh://git@github.com/user/repo)
giturl=${giturl/#ssh\:\/\/git\@github\.com\//https://github.com/}

providerUrlDifference=compare

giturl=${giturl%\.git}

giturl="${giturl}/${providerUrlDifference}/${branch}?expand=1"

# get current open browser command
case $( uname -s ) in
  Darwin)  open=open;;
  MINGW*)  open=start;;
  CYGWIN*) open=cygstart;;
  MSYS*)   open="powershell.exe –NoProfile Start";;
  *)       open=${BROWSER:-xdg-open};;
esac

# open it in a browser
$open "$giturl" &> /dev/null
exit $?

默认情况下,这个命令创建对master的pull请求,但我想创建对custom的请求。例如,我在local中有
test
分支,它被推送到origin。现在我想创建pull请求,以
dev
branchI找到它<代码>集线器拉取请求-m'拉取请求消息'-o-b dev-o---将在PR-b dev--从本地分支拉取请求到组织/开发的浏览器页面中打开