- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-pr
More file actions
Latest commit
executable file
·22 lines (16 loc) · 579 Bytes
/
Copy pathgit-pr
File metadata and controls
executable file
·22 lines (16 loc) · 579 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
source"utils.sh"
# Check if params are enough to go ahead.
repo=$(repo)
branch=$(git symbolic-ref --short -q HEAD)
to=${1:-develop}
# If a branch wasn't specified, determine it by looking in .githistory
if [[ "${1}"==""&&-f"${GIT_INFO_FILE}" ]];then
to=$(grep "^${repo}:${branch}""${GIT_INFO_FILE}"| cut -d':' -f3)
fi
# If github cli is installed, use that
if [[ $(gh_exists) ]];then
gh pr create --web --head "${branch}" --base "${to}" --title "${branch}"
exit 0
fi
open "https://www.github.com/${repo}/compare/${to}...${branch}"