Skip to content

Instantly share code, notes, and snippets.

@ejmr
Last active May 29, 2022 07:41
Show Gist options
  • Save ejmr/a927d32e25488a282bd3 to your computer and use it in GitHub Desktop.
Save ejmr/a927d32e25488a282bd3 to your computer and use it in GitHub Desktop.
Show the Description for the Current Branch
#!/bin/bash
#
# You can use `git branch --edit-description` to write a description
# for a branch, but Git provides no simple command to display that
# description. The "easiest" way to see it is via `git config --get
# branch.BRANCH_NAME.description`.
#
# This script automates that process and is meant to be used as
# a Git alias to provide a shorter command for showing the
# description of the current branch.
#
#######################################################################
BRANCH="$(git symbolic-ref --short HEAD)"
DESCRIPTION_PROPERTY="branch.${BRANCH}.description"
git config --get "$DESCRIPTION_PROPERTY"
@Plumbob
Copy link

Plumbob commented Jul 12, 2018

Thanks for the this. Really helpful. Minor typo: the beginning of Line 16 should be 'git', not 'get'

@BryanAdamss
Copy link

Its helpful~😁

@9mdv
Copy link

9mdv commented Dec 29, 2020

Thanks, I needed this. 👍

@ringerc
Copy link

ringerc commented May 6, 2022

It's absolutely bewildering that git branch list doesn't have a --descriptions

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