给git分支添加描述

Posted by Turingdo Studio on June 30, 2018

Hit this on terminal. This will display branches with description if your branch has some description.

Step 1:

vi ~/.bashrc

Step 2: Put this

alias git-describe-branches='for line in $(git branch); do 
     description=$(git config branch.$line.description)
     if [ -n "$description" ]; then
       echo "$line     $description"
     fi
done'

Step 3:

source ~/.bashrc

Step 4:

git-describe-branches

OR

for line in $(git branch); do 
     description=$(git config branch.$line.description)
     if [ -n "$description" ]; then
       echo "$line     $description"
     fi
done

Note:

Run this in git working directory.

Will show description if your branch has description.

编辑分支描述

git branch –edit-description 上述命令会打开一个编辑器,输入描述,保存即可(不会进入版本控制的)