Last active
September 7, 2017 13:28
-
-
Save seporaitis/d6a0aafe9f25e8844039f66de99c87ee to your computer and use it in GitHub Desktop.
Poor mans arcanist :~~~~~~~(
This file contains hidden or 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
#!/usr/bin/env bash | |
arc() { | |
if [ "$1" = "" ] | |
then | |
echo "arc (feature|diff|reset)" | |
return 1 | |
fi | |
command=$1 | |
if [ "$command" = "feature" ] | |
then | |
if [ "$2" = "" ] | |
then | |
echo "arc feature <name>" | |
return 1 | |
fi | |
name=$2 | |
git checkout -b $name | |
elif [ "$command" = "diff" ] | |
then | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
origin=$(git remote get-url --push origin) | |
remote=$(git ls-remote --heads $origin $branch) | |
git push origin $branch | |
if [ "$remote" = "" ] | |
then | |
hub pull-request $branch | |
else | |
echo "pull request already exists, doing nothing." | |
fi | |
elif [ "$command" = "reset" ] | |
then | |
git stash | |
git fetch origin | |
git checkout origin/master | |
git stash pop | |
else | |
echo "unknown command" | |
fi | |
return 0 | |
} | |
arc $1 $2 | |
retval=$? | |
exit $retval |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment