Skip to content

Instantly share code, notes, and snippets.

@kaneshin
Created July 3, 2014 16:14
Show Gist options
  • Save kaneshin/2486fa2c29ee39582ad2 to your computer and use it in GitHub Desktop.
Save kaneshin/2486fa2c29ee39582ad2 to your computer and use it in GitHub Desktop.
alias blp='bl | peco | chbarg'
function chbarg()
{
target=`awk '{print $1}' | sed -e 's/^remotes\///'`
branch=`echo $target | awk '{sub("/", "-"); print $0;}'`
git checkout -b $branch $target
if [[ $? != 0 ]]; then
git checkout $branch
fi
}
function bl()
{
branches=`git branch -a 2> /dev/null | sed -e 's/^..//'` && tags=`git tag`
result=`echo $branches "\n" $tags | awk '{print $1}'`
while read LINE
do
echo $LINE " " `git log --oneline -n 1 $LINE`
done <<< $result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment