mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-18 19:51:35 +02:00
Add scripts to facilitate checkout and merge PR branches for testing purposes
This commit is contained in:
31
remote-branch.sh
Executable file
31
remote-branch.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# if $1 is user:branch, split it into $USER and $BRANCH at the :
|
||||
if [[ $1 == *:* ]]; then
|
||||
echo "Splitting $1 into user and branch"
|
||||
USER=$(echo $1 | cut -d: -f1)
|
||||
BRANCH=$(echo $1 | cut -d: -f2)
|
||||
else
|
||||
# if $1 and $2 are not both specified, fail
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
echo "Usage: $0 <username> <branch>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# provide defaults for $1 and $2 for safety anyway
|
||||
USER=${1:-ripmeapp}
|
||||
BRANCH=${2:-main}
|
||||
fi
|
||||
|
||||
# Check that USER and BRANCH are not empty
|
||||
if [ -z "$USER" ] || [ -z "$BRANCH" ]; then
|
||||
echo "Usage: $0 <username> <branch>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOCAL_BRANCH=$USER-$BRANCH
|
||||
REMOTE_BRANCH=$USER/$BRANCH
|
||||
|
||||
git remote add $USER https://github.com/$USER/ripme.git
|
||||
git fetch $USER $BRANCH
|
||||
git checkout -B $LOCAL_BRANCH $USER/$BRANCH
|
31
remote-merge.sh
Executable file
31
remote-merge.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# if $1 is user:branch, split it into $USER and $BRANCH at the :
|
||||
if [[ $1 == *:* ]]; then
|
||||
USER=$(echo $1 | cut -d: -f1)
|
||||
BRANCH=$(echo $1 | cut -d: -f2)
|
||||
else
|
||||
# if $1 and $2 are not both specified, fail
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
echo "Usage: $0 <username> <branch>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# provide defaults for $1 and $2 for safety anyway
|
||||
USER=${1:-ripmeapp}
|
||||
BRANCH=${2:-main}
|
||||
fi
|
||||
|
||||
# Check that USER and BRANCH are not empty
|
||||
if [ -z "$USER" ] || [ -z "$BRANCH" ]; then
|
||||
echo "Usage: $0 <username> <branch>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOCAL_BRANCH=$USER-$BRANCH
|
||||
REMOTE_BRANCH=$USER/$BRANCH
|
||||
|
||||
git remote add $USER https://github.com/$USER/ripme.git
|
||||
git fetch $USER $BRANCH
|
||||
git checkout -B $LOCAL_BRANCH origin/main
|
||||
git merge $REMOTE_BRANCH
|
Reference in New Issue
Block a user