mirror of
https://github.com/ViViDboarder/shoestrap.git
synced 2024-12-27 19:37:39 +00:00
25 lines
800 B
Bash
Executable File
25 lines
800 B
Bash
Executable File
#! /bin/bash
|
|
|
|
# Created by ViViDboarder. Please share with attribution
|
|
# Function used to take a github http pull URL and automatically convert it to an ssh url
|
|
|
|
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."
|
|
|
|
exit 1
|
|
fi
|
|
|
|
# Expects $* to be in the form of htts://github.com/user/repo branch
|
|
URL=${1/http:\/\//git@} # Replace https:// with git@ at the beginning
|
|
URL=${URL/\//:} # Replace / with : before the user name
|
|
|
|
# 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
|