Skip to content

Instantly share code, notes, and snippets.

@asiviero
Last active August 10, 2016 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asiviero/6241b8212fbe00a3c95cd759d4364f33 to your computer and use it in GitHub Desktop.
Save asiviero/6241b8212fbe00a3c95cd759d4364f33 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Get the issue based on a WEB-\d+ regex and prepend it to the commit msg
issue=$(git symbolic-ref HEAD | sed -n 's/^.*\(WEB-[0-9][0-9]*\).*$/\1/p')
if [ -n "$issue" ]; then
echo -n "$issue " | cat - $1 > /tmp/out && mv /tmp/out $1
fi
@heybrun
Copy link

heybrun commented Aug 10, 2016

Windows version. Need a place where you have write access. Something like:

#!/bin/sh
#
# Get the issue based on a WEB-\d+ regex and prepend it to the commit msg
issue=$(git symbolic-ref HEAD | sed -n 's/^.*\(WEB-[0-9][0-9]*\).*$/\1/p')
if [ -n "$issue" ]; then
        echo -n "$issue " | cat - $1 > /c/users/[user]/documents/out && mv /c/users/[users]/documents/out $1
fi

@asiviero
Copy link
Author

Merci, @heybrun

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