Skip to content

Instantly share code, notes, and snippets.

@aprgl
aprgl / git_branch.sh
Created February 18, 2018 19:50 — forked from dciccale/git_branch.sh
Bash script to get the current git branch and last commit
#!/usr/bin/env bash
# checks if branch has something pending
function parse_git_dirty() {
git diff --quiet --ignore-submodules HEAD 2>/dev/null; [ $? -eq 1 ] && echo "*"
}
# gets the current git branch
function parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"

Keybase proof

I hereby claim:

  • I am aprgl on github.
  • I am aprgl (https://keybase.io/aprgl) on keybase.
  • I have a public key ASCrsZydL4wffWRUwGsAMRWmuS1RMKaCZJfVJiWkBqklJwo

To claim this, I am signing this object: