Skip to content

Instantly share code, notes, and snippets.

@IanVaughan
Created April 7, 2016 06:27
Show Gist options
  • Save IanVaughan/4bc99c3392f7af21e2875bd2aff8fd0f to your computer and use it in GitHub Desktop.
Save IanVaughan/4bc99c3392f7af21e2875bd2aff8fd0f to your computer and use it in GitHub Desktop.
Create git branch from ticket summary string
#!/usr/bin/env ruby
# Put this in your path named something like git-cbr
# chmod +x git-cbr
# then can git cbr This is the /ticket/I/am/working on
# creates a branch named "this-is-the-ticket-i-am-working-on"
safe_name = ARGV.map { |a| a.downcase }.join("-").gsub(/[^\w+]/, "-").gsub("--", "-")
%x{git co -b #{safe_name}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment