Skip to content

Instantly share code, notes, and snippets.

@greenbicycle
Created April 5, 2018 17:42
Show Gist options
  • Select an option

  • Save greenbicycle/c1d4d2ebe15f7ce9e69c53b45488a00d to your computer and use it in GitHub Desktop.

Select an option

Save greenbicycle/c1d4d2ebe15f7ce9e69c53b45488a00d to your computer and use it in GitHub Desktop.
find branch name in git based on Manuscript case number
#!/bin/bash
#
# Find a branch name based on the Manuscript case number
#
# $1 should be a manuscript case number
# It will be copied to the clipboard
#
# sed is for removing the '* ' from the beginning of the line
# tr removes the newline at the end
BRANCH=$(git branch | grep $1 | sed 's/^..//' | tr -d "\n")
# If you are not on a Mac, remove the pbcopy
# Then the branch name will go to stdout
printf $BRANCH | pbcopy
@greenbicycle
Copy link
Copy Markdown
Author

greenbicycle commented Apr 5, 2018

I use Manuscript (formerly known as Fogbugz). This helps me find the branch easily when i am merging.

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