Created
June 23, 2020 19:31
-
-
Save xpepper/d17c9e526c4eb44c325c837abc7693f7 to your computer and use it in GitHub Desktop.
A script to perform a git handover in a mob session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
COMMAND=$1 | |
BRANCH=$2 | |
if [[ "$COMMAND" == "init" ]] | |
then | |
echo "INITIALIZING SESSION '$BRANCH'" | |
git fetch --prune | |
git pull --ff-only | |
git branch $BRANCH | |
git checkout $BRANCH | |
git push --no-verify --set-upstream origin $BRANCH | |
elif [[ "$COMMAND" == "start" ]] | |
then | |
echo "STARTING YOUR SESSION ON '$BRANCH'" | |
git fetch --prune | |
git pull --ff-only | |
git checkout -B $BRANCH origin/$BRANCH | |
git branch --set-upstream-to=origin/$BRANCH $BRANCH | |
elif [[ "$COMMAND" == "next" ]] | |
then | |
echo "HANDOVER SESSION TO THE NEXT PERSON ON '$BRANCH'" | |
git add --all | |
git commit --message "mob next [ci-skip]" --no-verify | |
git push --no-verify origin $BRANCH | |
elif [[ "$COMMAND" == "reset" ]] | |
then | |
echo "RESET SESSION '$BRANCH'" | |
git fetch origin | |
git checkout master | |
git branch --delete --force $BRANCH | |
git push --no-verify origin --delete $BRANCH | |
else | |
echo "Usage:" | |
echo "'$0 init [session-name]' # initialize a new mob session" | |
echo "'$0 start [session-name]' # start your turn on a mob session" | |
echo "'$0 next [session-name]' # handover the mob session to the next person" | |
echo "'$0 reset [session-name]' # reset the mob session" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment