shoestrap/assets/default/bin/ghp

27 lines
792 B
Plaintext
Raw Permalink Normal View History

2017-07-11 18:02:31 +00:00
#! /bin/bash
# Created by ViViDboarder. Please share with attribution
2013-08-08 03:23:13 +00:00
# Function used to take a github http pull URL and automatically convert it to an ssh url
2013-08-08 03:23:13 +00:00
if [[ "$1" == "" ]]; then
echo "Usage"
echo "ghp <url> <branch>"
echo "Example"
echo "ghp https://github.com/user/repo branch"
echo
echo "This function will convert the URL into an ssh url and"
echo "then it will execute git pull --edit --no-ff to merge."
2017-08-30 23:56:20 +00:00
exit 1
2013-08-08 03:23:13 +00:00
fi
# Expects $* to be in the form of htts://github.com/user/repo branch
# Replace https:// with git@ at the beginning
URL=${1/http:\/\//git@}
# Replace / with : before the user name
URL=${URL/\//:}
2013-08-08 03:23:13 +00:00
# Echo the command so we can see what we actually executed
echo "git pull --edit --no-ff $URL $2"
git pull --edit --no-ff "$URL" "$2"