Skip to content

Instantly share code, notes, and snippets.

@swider
Created February 4, 2011 21:55
Show Gist options
  • Select an option

  • Save swider/811855 to your computer and use it in GitHub Desktop.

Select an option

Save swider/811855 to your computer and use it in GitHub Desktop.
Command line utility to search git repo
#!/bin/bash
QUERY=`echo $1 | sed 's/ /+/'g`
DIR=$PWD
function parse_github_repo {
echo `cd $DIR;git config -l | grep 'remote.origin.url' | sed -En 's/remote.origin.url=git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/\3\/\4/p'`
}
URL="https://github.com/$(parse_github_repo)/search?q=$QUERY"
if [ "`which gnome-www-browser`" != "" ]; then
gnome-www-browser $URL
else
open $URL
fi
@sarnobat
Copy link
Copy Markdown

Will this work for private enterprise git instances?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment