Created
February 17, 2023 19:00
-
-
Save bruce-ricard/322cb9135673fef163e935d8852abbc9 to your computer and use it in GitHub Desktop.
Git "love" alias for displaying logs for a specific line or line range
This file contains hidden or 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
| [alias] | |
| love = "!f(){ \ | |
| if [[ -z $1 ]]; then echo 'You must pass a file name as the first parameter to \"love\"' >&2 ; exit 1; fi ;\ | |
| if [[ -z $2 ]]; then echo 'You must pass a line matcher as the second parameter to \"love\"' >&2 ; exit 1; fi ;\ | |
| FILE_NAME=$1 ;\ | |
| FIRST_LINE=$2 ;\ | |
| LAST_LINE=${3:-+1} ;\ | |
| git log -L ${FIRST_LINE},${LAST_LINE}:${FILE_NAME} ;\ | |
| };f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment