DEV Community

Discussion on: Enforce git commit messages automatically

Collapse
 
jingxue profile image
Jing Xue

git branch --show-current will give you the current branch name.

For "dirtiness" detection you might just run git status --porcelain. If it outputs nothing, the working directory is clean.

Collapse
 
piyushkmr profile image
Piyush Kumar Baliyan

Thanks for the git status pointer, that is something new that I learned.
Although I generally don't use dirty check as it add a delay to each terminal prompt.