Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (32 sloc) 622 Bytes
#!/usr/bin/env bash
# Shorter squash
function gsq() {
if [ -z $1 ]; then
echo "Please provide amount to squash"
return 1
fi
git rebase -i HEAD~$1
}
# `cd` to git project root
function gcd() {
declare TEMP_PWD=$(pwd)
while ! [ -d .git ]; do
cd ..
done
declare OLDPWD=$TEMP_PWD
}
# Check out a Github PR as a local branch
function gpr() {
if [ -z $1 ]; then
echo "Please provide a PR id"
return 1
fi
git fetch origin pull/$1/head:pr/$1
git checkout pr/$1
}
function gsb() {
git fetch -p && \
for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`;
do git branch -D $branch;
done
}