Pregunta

I have been researching how to change this behavior all day with no luck, so here goes.

Is there a way in iterm2, when viewing git logs, to change the way the cmd+click functions on the git log hash? Ideally, I am hoping that cmd+click would would open a browser window with the correct github url where the change set could be viewed.

If this is not possible, please let me know. I believe this would be very helpful to others, I wish I had the magic wand to figure out how to configure this.

Thoughts?

¿Fue útil?

Solución

While this is not ideal, here is how I was able to work around this issue. I built a commit hook! Not perfect, I know. Ideas?

#!/bin/sh
#
# Automatically adds branch name and branch description to every commit message.
# Edit .git/hooks/commit-msg & make sure it is excutable chmod +x
# Requires git config --add remote.github.url {value}
#
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
TEXT=$(cat "$1" | sed '/^#.*/d')
GIT_COMMIT_SHORT_ID=$(git rev-parse --short HEAD)
GIT_COMMIT_ID=$(git rev-parse HEAD)
GIT_GITHUB_URL=$(git config --get remote.github.url)

if [ -n "$TEXT" ]
then
    echo "$NAME"': '$(cat "$1" | sed '/^#.*/d') > "$1"
    if [ -n "$DESCRIPTION" ]
    then
       echo "" >> "$1"
       echo $DESCRIPTION >> "$1"
    fi
    echo $GIT_GITHUB_URL$GIT_COMMIT_ID >> "$1"
else
    echo "Aborting commit due to empty commit message."
    exit 1
fi
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top