Skip to content

Instantly share code, notes, and snippets.

@kentokento
Created July 3, 2014 13:02
Show Gist options
  • Save kentokento/50ad235b0c8a1212b032 to your computer and use it in GitHub Desktop.
Save kentokento/50ad235b0c8a1212b032 to your computer and use it in GitHub Desktop.
#!/bin/bash
# show branches list & theses newest log -1
branch=""
branches=`git branch --list`
while read -r branch; do
branch_name=${branch//\*\ /}
label=`git log -1 --pretty=format:'%s' $branch_name`
if expr "$branch" : "^[^\*].*" >/dev/null; then
echo -n " "
fi
printf "%-15s %s\n" "$branch" "$label"
done <<< "$branches"
# vi .gitconfig
# [alias]
# branch-label = !/home/user/branch-label.sh
# exsample
# * master hotfix hogehoge
# one one one commit
@kentokento
Copy link
Author

Git branchで一緒に最新ログのメッセージも表示する。
適当なところにおいてコマンドで呼べるようにしておけば少し楽

vi .gitconfig
[alias]
branch-label = !/home/user/branch-label.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment