Skip to content

Instantly share code, notes, and snippets.

@seporaitis
Last active September 7, 2017 13:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seporaitis/d6a0aafe9f25e8844039f66de99c87ee to your computer and use it in GitHub Desktop.
Save seporaitis/d6a0aafe9f25e8844039f66de99c87ee to your computer and use it in GitHub Desktop.
Poor mans arcanist :~~~~~~~(
#!/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