Skip to content

Instantly share code, notes, and snippets.

@index0h
Created April 15, 2015 11:49
Show Gist options
  • Save index0h/210b7c16a015d2c5447c to your computer and use it in GitHub Desktop.
Save index0h/210b7c16a015d2c5447c to your computer and use it in GitHub Desktop.
Commit name maker
#!/bin/bash
# Current script works with branches by next standars:
# dev-{YYYYmmdd}-{surname}-N{ticket number}-{ticket name}
# dev-{YYYYmmdd}-{surname}-{ticket number}-{ticket name}
#
# {YYYYmmdd} - branch creation date
# {surname} - authors surname
# {ticket number} - number of ticket in your bug tracker
# {ticket name} - short ticket description, words could be separated by - or _
#
# Result of current script will be something like
# {ticket name separated by space} (refs #{ticket number})
git branch | grep '*' | sed 's/[-_]/ /g' | sed 's/^\* [^ ]\+ [^ ]\+ [^ ]\+ //' | sed 's/N\?\([0-9]\+\) \(.\+\)/\2 (refs #\1)/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment