paulirish / git-open Goto Github PK
View Code? Open in Web Editor NEWType `git open` to open the GitHub page or website for a repository in your browser.
License: MIT License
Type `git open` to open the GitHub page or website for a repository in your browser.
License: MIT License
When I have push.default
set to upstream
I think the upstream branch should be opened.
I can put together a PR if you want to offer some guidance in what you are looking for.
shellcheck is great for common bash style/security concerns
https://github.com/koalaman/shellcheck#travis-ci-setup
The sourcebase in bash hasn't been holding up well to all of the string manipulation.
I think it could use a rewrite. Plus it'd open us up to write some tests for all the string acrobatics it's gained.
Personally I'd prefer JavaScript but requiring node seems excessive. Python seems like a reasonable choice, but I'm personally open.
I won't have time to do this myself, so it's open to anyone interested.
git open --help
tries to open the man page for the command but there is no man page.
Hopefully somebody is brave enough to write one!
Not sure if the source of such a man page should be troff or something better like restructuredtext or markdown (which can be converted to man pages with rst2man or md2man, but require additional build dependencies)
A large part of the documentation could come from the README.md
My common workflow is:
git open
There's not much value in me opening the branch page. ideally a flag like --new-pr
would open the create-a-pull-request link directly.
So:
env BROWSER=echo git open
# https://github.com/GoogleChrome/lighthouse/tree/bootuptime-edit
env BROWSER=echo git open --new-pr
# https://github.com/GoogleChrome/lighthouse/compare/bootuptime-edit?expand=1
anyone else interested in this one? (looks like #64 basically wanted the same thing)
do bitbucket/gitlab/vsts have similar URLs?
I am having trouble getting this to work with the .oh-my-zsh
install instructions. First question does this require hub to be installed?
$ git --version
git version 2.6.4 (Apple Git-63)
$ git open
git: 'open' is not a git command. See 'git --help'.
Did you mean one of these?
clean
clone
notes
prune
Is there any way you could get this into hub? It seems more like a missing feature in hub than its own feature! hub has a browse
command to open the repo / issues / wiki, but not the pages. It's pretty neat, though.
Too bad. This will only just open the primary page of the repo.
the fantastic https://github.com/jingweno/gh
and the more classic hub
project have your back
edits by @davidosomething:
jingweno/gh was deprecated, use https://github.com/github/hub (
hub browse
) for better GitHub support
With the rewrite we'll want to ship our 2.0
Also our model for gitlab configuration changed, so we have a breaking change.
I created a milestone to capture issues that are potentially in scope for 2.0.
https://github.com/paulirish/git-open/milestone/1
I get the following when I type git open
/Users/arian/.oh-my-zsh/custom/plugins/git-open/git-open: line 99: ${ssh_optcode^^}: bad substitution
If an incorrect URL is opened, please provide the following so we can write a test:
[email protected]:abc/abc-dfg.git
one-to-one-3
It went to the right url
https://github.foo.example.com/abc/abc-dfg/tree/one-to-one-3
as mentioned in #79
Using a gitblit repo, it opened the following (wrong) URL:
https://gitblitremoteexample.com/r/my-repo/tree/my-branch
And I think it should open the following:
https://gitblitremoteexample.com/summary/my-repo.git/my-branch
git://gitblitremoteexample.com/my-repo.git
my-branch
https://gitblitremoteexample.com/summary/my-repo.git/my-branch
If an incorrect URL is opened, please provide the following so we can write a test:
https://aur.archlinux.org/git-open-git.git or ssh://[email protected]/git-open-git.git
master
https://aur.archlinux.org/packages/git-open-git
It will be a simple fix. We can add a simple if condition with a regex to check if the URL is of the AUR, and if it is, we just need to append the /packages/
part to the URL.
For example,
URL opened by git open
: https://aur.archlinux.org/git-open-git
Actual URL: https://aur.archlinux.org/packages/git-open-git
if [ $domain == "aur.archlinux.org" ]; then
domain="$domain/packages"
fi
When I typed git open
inside Github project, it opens my Github remote repo page nicely. Example:
https://github.com/paulirish/git-open
But, when I typed git open
inside Bitbucket project, it opens my Bitbucket remote repo like this:
https://bitbucket.org/[username]/[repo]/branch/master
How do I open it like this?
https://bitbucket.org/[username]/[repo]
(without /branch/master/
part)
Note:
This Bitbucket project is private project.
Since upgrading (from which version I'm not sure), git open
is opening URLs at a nonexistent ssh
subdomain. The repos were all cloned with SSH, in case that has something to do with it. This was never an issue before...
Thanks. Let me know if you need additional info.
If an incorrect URL is opened, please provide the following so we can write a test:
https://github.com/goodguyry/postcss-tidy-columns
master
https://github.com/goodguyry/postcss-tidy-columns
Hi,
My request is quite straight forward. Support for http://beanstalkapp.com/ would be awesome! If you need any testing, i'm available for that!
Thanks in advance.
If an incorrect URL is opened, please provide the following so we can write a test:
$ git clone https://github.com/ory/hydra/
$ git checkout tags/v1.0.0-beta.8
Add a flag to open CI/CD tool URL:
git open --cx
Based on the contents of the repo we could identify the CI URLs. However, there are a lot of limitations. For travis, circleci etc. we could identify the URL easily but for self-hosted CI/CD tools like GoCD, Jenkins it will be difficult.
Adding this idea here so that someone could come up with a better way to do it. Let me know if this feature makes sense.
If an incorrect URL is opened, please provide the following so we can write a test:
https://github.com/Tadaboody/Rate_My_Config.git
master
https://github.com/Tadaboody/Rate_My_Config/issues
git-open
git-open -I
We have two failing tests after the rewrite has landed
✗ gitlab: separate domains
(from function `assert_output' in file test/test_helper/bats-assert/src/assert.bash, line 239,
in test file test/git-open.bats, line 186)
`assert_output "https://gitlab.example.com/namespace/project"' failed
fatal: remote origin already exists.
Switched to a new branch 'master'
-- output differs --
expected : https://gitlab.example.com/namespace/project
actual : https://git.example.com/namespace/project
✗ gitlab: ssh://git@host:port origin
(from function `assert_output' in file test/test_helper/bats-assert/src/assert.bash, line 239,
in test file test/git-open.bats, line 220)
`assert_output "https://repo.intranet/XXX/YYY"' failed
fatal: remote origin already exists.
Switched to a new branch 'master'
-- output differs --
expected : https://repo.intranet/XXX/YYY
actual : https://repo.intranet/7000/XXX/YYY
--
@derimagia how did you want to handle these guys?
I was testing this plugin with my repo and it opened the URL https://github.com/theoriginalbit/repo//master
instead of https://github.com/theoriginalbit/repo/tree/master
resulting in GitHub 404'ing.
It would be nice to be able to run git open pr
and get the first PR it finds for the current branch.
Could you please add support for bash on Windows?
I was just thinking it would be cool to be able to do something like:
git-open /path/to/file
and have the browser open that file in that branch that one was in ...
Don't forget to make it executable!
Have a custom flag which will take a value
and append to the url before opening
git open -s pipelines // opens pipelines page
git open -s wiki // opens wiki page
git open -s projects // opens projects board
I have a private github repo with URL in SSH format:
$ git config --get remote.origin.url
ssh://[email protected]/foo/bar.git
The readme says
Windows with cmd terminal
Save the git-open script in any place accessible via your %PATH% environment var.
but that doesn't work. Why would it as the git-open script uses !# which does not work on cmd. It no doubt does work in WSL. Unless git should find it and handle it? I plonked mine in c:\windows\system32
, naughty by it should work there AFAIK
However npm I -g git-open
installs it just fine.
Sadly though, using nvm-windows loses global installs when you switch versions ;(
RT
Hi, this commando don't open the issues page, just go to the main repo page...
tested on github and gitlab
git open --issue
someone know how fix it?
Thanks in advance,
On Ubuntu I get hundreds of lines of output when firefox starts up from the command line. To prevent, that, change the 2nd to last line of the script to:
$open $giturl &> /dev/null
It's true that HTTP URLs contain /scm/
, but that's for read-only access. If you're working with a repo that you can push to, it has an SSH URL that looks like this:
ssh://[email protected]:7999/foo/ken-homedir.git
where foo
is a 3-or-4-letter key for the Project (a grouping of repositories).
In this case, perhaps recognizing the port number or the global format of the URL might be necessary. Open to a patch for that?
A license added to this repo would make it easier for people to use this in their own dotfiles etc. :-)
How about git open --print
.
2 use cases:
git open --print | pbcopy
would help a lotThe readme states:
$ git open issue
# If branches use naming convention of issues/#123,
# opens https://github.com/REMOTE_UPSTREAM_USER/CURRENT_REPO/issues/123
However, the current behaviour is better explained by:
$ git open issue
# If branches use naming convention of issues/#123,
# opens https://github.com/REMOTE_ORIGIN_USER/CURRENT_REPO/issues/123
The behaviour in the README makes sense and is intuitive, so it would be good if the actual program could match that.
Is there any plans to support Gitlab? Specially those repos that are self hosted.
Hi, I'm using arch + tilix + ohmyzsh and it don't work...
any error message...
someone know how fix it?
even if I use:
npm install --global git-open
Thanks in advance,
If you're in a detached HEAD state, ${2:-$(git symbolic-ref -q --short HEAD)}
gives nothing.
If you use git symbolic-ref HEAD
and it fails with fatal: ref HEAD is not a symbolic ref
, you're in a detached HEAD.
Being in this state, git status
gives you, for example, HEAD detached at 1.1b1
. You can extract the tag/branch/commit after HEAD detached at
and complement the https://github.com/ORG/REPO/tree/EXTRACTED and be able to open repositories in detached HEAD. It worked with the short hash.
...or if you're into an even more pragmatic approach, do an if grep -v 'HEAD detached'; then
and extract the hash. :)
More info about detached HEAD: https://stackoverflow.com/a/5772882
Now that #132 has been landed, I'd appreciate a new release, so I don't need to install from git.
Thanks!
So bitbucket is supposed to be able to view a branch URL like:
bitbucket.com/user/repo/src/mybranch/
However we're currently mimicking the URL that the site generates like:
bitbucket.com/user/repo/src/commitsha/?at=branchname
I'd prefer to use the simple version, as @derimagia's rewrite does. However it turns out there's a problem with branches including a /
(slash) in the name.
I've filed this issue upstream: https://bitbucket.org/site/master/issues/14422/source-view-url-of-branch-name-with
Until that's resolved, I think we'll need the longer URL (unless someone identifies a better workaround).
So for now, this is our downstream tracking issue until the BB one is fixed. 😉
xdg-open
for linux. start
for windows. would be nice.
If an incorrect URL is opened, please provide the following so we can write a test:
https://www.mydomain.com/userName/projectName.git
release
How about git open --commit xxxx
?
Bashit is like oh-my-zsh.
This would be a nice plugin to have.
The way are tests are currently set up, Markdownlint is not actually linting our Markdown files.
To illustrate this, in master (which is currently green on Travis), this heading is level 4, while the preceeding heading is level 2, which violates MD001 - Header levels should only increment by one level at a time.
This affects both npm run lint:readme
and npm run lint:man
.
Would it be possible to update the package published on npmjs.org? https://www.npmjs.com/package/git-open
The current release is over one year old...
If I have multiple remotes, and I do a git push -u other branchname
, I would expect 'git open' to open whatever the current remote is, as opposed to using origin.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.