Skip to content

Instantly share code, notes, and snippets.

@Marthyn
Last active August 29, 2015 14:23
Show Gist options
  • Save Marthyn/7b691fc2406baf683cce to your computer and use it in GitHub Desktop.
Save Marthyn/7b691fc2406baf683cce to your computer and use it in GitHub Desktop.
Favourite shell functions
yolo() {
git add .
git commit -am 'YOLO'
git push origin $1 -f
}
# Hoppinger release
# Usage `release -v 1.0.1 -e testing`
release() {
git checkout master
while getopts ":v:" opt; do
VERSION=$OPTARG
BRANCH="release/$VERSION"
echo "Git stuff"
git checkout -b $BRANCH &&
git checkout $BRANCH &&
git push origin $BRANCH &&
git tag $VERSION $BRANCH &&
git push origin $VERSION
echo "Deploying"
while getopts ":e:" opt; do
cap $OPTARG deploy &&
echo "Great success, version $VERSION was tagged and deployed to $OPTARG"
done
done
}
oops() {
echo "Reverting last commit"
git reset HEAD~1
}
forget() {
echo "Removing last commit"
if [ $# -eq 0 ]; then
git reset HEAD~$1
else
git reset HEAD~1
fi
dropchanges
}
dropchanges() {
if [ $# -eq 0 ]; then
git add .
git stash
else
git add $1
git stash $1
fi
git stash drop
}
resetrepo() {
if [ $# -eq 0 ]; then
git reset --hard HEAD
else
git reset --hard $1
fi
}
driveby() {
lsof -P | grep ":$1" | awk "{print $2}" | xargs kill -9
echo "Killed everything on port $1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment