Created
December 2, 2012 18:41
-
-
Save kswedberg/4190376 to your computer and use it in GitHub Desktop.
commit pull request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cipreq() { | |
if [ -z "$1" ] | |
then | |
echo `git log -1 --no-merges --pretty=format:'git commit -a --author="'"%an <%aE>"'" --message="'"%s %b"'"'` | |
return 1 | |
fi | |
AUTHOR=$1 | |
if [ -z "$2" ] | |
then | |
MSG="" | |
else | |
MSG="--grep=${2}" | |
fi | |
echo `git log -1 ${MSG} --author="${AUTHOR}" --no-merges --pretty=format:'git commit -a --author="'"%an <%aE>"'" --message="'"%s %b"'"'` | |
} |
If the author committed again after sending the pull request and that other commit was merged in, you can specify a distinctive word within the commit message that you're targeting. It would look like this:
cipreq Karl somethingFromCommit
This is starting to feel hackish. I wish I knew how to do command-line arguments of the --
variety so we could do something like cipreq --author=Karl --msg=somethingFromCommit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
This simple function is meant to help those who want merge pull requests into a repo and give proper attribution to the pull request's author. Run the
cipreq
command on the command line to get agit commit
line that you can copy and paste back into the terminal.If you just type
cipreq
alone, it will use the last commit (by date) to the repo. If you add the author's name, or any part of that name, to the command, it will use the last commit by that author. For example, enteringcipreq Karl
will give you the copy/paste line using the author and message of the last commit by someone with "Karl" in his name.