Skip to content

Instantly share code, notes, and snippets.

@nvk
Last active June 17, 2023 17:50
Show Gist options
  • Save nvk/3a0471c8aad6a7db076720d2f53ad085 to your computer and use it in GitHub Desktop.
Save nvk/3a0471c8aad6a7db076720d2f53ad085 to your computer and use it in GitHub Desktop.

Git(Hub) 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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment