Last Updated: February 25, 2016
·
859
· nvk

Git Time Savers

Get's branch, fetches origin, resets hard.

gifu(){
    branch=$(git rev-parse --abbrev-ref HEAD);
    git fetch origin;
    git reset --hard origin/$branch;
    print -P "%F{$colorSuccess}=> Git I Fucked Up, reseted your branch%f"
}

Open Project on Github

gop(){
    open `git remote -v | sed 's/^.*:/http:\/\/github.com\//' | sed 's/.git .*//' | tail -1`
}

Open Project Issues on Github

gip(){
    url=$(git remote -v | perl -n -e 'm{:(.+?).git} && print $1,"\n"' | uniq );
    open "http://github.com/$url/issues"
}

3 Responses
Add your response

gop() doens't work it opens github.com//

over 1 year ago ·

this is better:

gop(){
open git remote -v | sed 's/^.*:/http:\/\/github.com\//' | sed 's/.git .*//' | tail -1
}

over 1 year ago ·

gifu is the best :)

My solution looks like this but it says (and the method name is: grst):
"Good news everyone, you lost everything on branch ${branch}, start over again..."

over 1 year ago ·