Type git open to open the repo website (GitHub, GitLab, Bitbucket) in your browser.
Usage
git open [remote-name] [branch-name]
# Open the page for this branch on the repo website
git open --commit
git open -c
# Open the current commit in the repo website
git open --issue
git open -i
# If this branch is named like issue/#123, this will open the corresponding# issue in the repo website
git open --print
git open -p
# Only print the url at the terminal, but don't open it
(git open works with these hosted repo providers, git open --issue currently only works with GitHub, Visual Studio Team Services and Team Foundation Server)
Examples
$ git open
# opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/tree/CURRENT_BRANCH
$ git open someremote
# opens https://github.com/PROVIDED_REMOTE_USER/CURRENT_REPO/tree/CURRENT_BRANCH
$ git open someremote somebranch
# opens https://github.com/PROVIDED_REMOTE_USER/CURRENT_REPO/tree/PROVIDED_BRANCH
$ git open --issue
# If branches use naming convention of issues/#123,# opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/issues/123
$ git open --print
# prints https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/tree/CURRENT_BRANCH
$ git open --suffix pulls
# opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/pulls
Installation
Basic install
The preferred way of installation is to simply add the git-open script
somewhere into your path (e.g. add the directory to your PATH environment
or copy git-open into an existing included path like /usr/local/bin).
Install via NPM:
npm install --global git-open
Windows Powershell
Save git-open anywhere, say as ~/Documents/Scripts/git-open.sh and define
a function in your Powershell profile (see ~/Documents/WindowsPowerShell/profile.ps1) like this:
Add antigen bundle paulirish/git-open to your .zshrc with your other bundle
commands.
Antigen will handle cloning the plugin for you automatically the next time you
start zsh, and periodically checking for updates to the git repository. You can
also add the plugin to a running zsh with antigen bundle paulirish/git-open
for testing before adding it to your .zshrc.
Add zgen load paulirish/git-open to your .zshrc file in the same function
you're doing your other zgen load calls in. ZGen will take care of cloning
the repository the next time you run zgen save, and will also periodically
check for updates to the git repository.
Please provide examples of the URLs you are parsing with each PR.
Testing:
You'll need to install bats, the Bash automated testing system. It's also available as brew install bats
git submodule update --init # pull in the assertion libraries# Run the test suite once:
bats test# or `npm run unit`# Run it on every change with `entr`
brew install entr
npm run watch
请发表评论