Show current GIT branch name
function git-name {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
Show current GIT branch description
function git-desc {
branch=$(git rev-parse --abbrev-ref HEAD)
desc=$(git config branch.$branch.description)
echo -e "$desc"
}
Show all GIT branches name with description
function git-br {
branches=$(git for-each-ref --format='%(refname)' refs/heads/ | sed 's|refs/heads/||')
for branch in $branches; do
desc=$(git config branch.$branch.description)
if [ $branch == $(git rev-parse --abbrev-ref HEAD) ]; then
branch="* \033[0;32m$branch\033[0m"
else
branch=" $branch"
fi
echo -e "$branch \033[0;36m$desc\033[0m"
done
}
Show current GIT branch name in console
export PS1="\[\033[01;36m\]\u@\h:\[\033[01;34m\]\$(git-name) \[\033[01;32m\]\w \[\033[01;34m\]\n$ \[\e[0m\]"
mg = merge
br = branch
ci = commit
st = status
rb = rebase
co = checkout
llog = log -1
cr = cherry-pick
ca = !git add -A . && git commit