gitr: copy git remote

Too often I found myself needing the repo URL of the git repository I am currently working in.

Of course, you can always type
git config --get remote.origin.url
but who has time for that?

If you source the following file in your shell, you will then have access to
which will output the git remote URL, and you can
open $(gitr)
to quickly open the URL in your browser.

You will also have access to
which will copy the git remote to your clipboard so you can quickly paste it anywhere you need to.
#!/bin/bash copyfx='' if [[ `uname` -eq 'Darwin' ]]; then copyfx='pbcopy' elif [[ `uname` =~ "cygwin"* ]]; then copyfx='putclip' else copyfx='xclip' fi function gitr () { git config --get remote.origin.url | tr -d '\n' } function cgitr () { gitr | tr -d '\n' | $copyfx } if [[ "$0" != "$_" ]]; then `cgitr` fi


last updated 2019-02-18T15:56:19+0000