I find myself frequently needing to go to the homepage of the projects I contribute to on GitHub. I have bookmarked the important ones, and a quick...
For further actions, you may consider blocking this person and/or reporting abuse
I use the ssh format for adding my remotes, this only seems to pick up http urls.
I hastily redid an else condition that will work with
git@github.com:
remotes as well.Just a small & quick modification to add current branch & non-github domain -
.../bin/git-browse
Nice!
Just for fun: do you have any idea how to add this as a
hub
command to git? ❤Just put it in a script called
git-hub
and add that to a directory in your path.Aye! Thanks!
Personally, I prefer this command to be associated with the
hub
alias, so I can just run:And since the folder name is really often the same as the repository name, here's my solution:
Make sure you change
<your username>
to your username.Now you can run
If the name of the folder doesn't correspond to the name of the repository, you can add a
.githubrepo
file and set its content to the name of it, and it'll use this instead.Hopefully it'll save some people a bit of time
There's a feature in Git called insteadOf that allows you to make shorthand URLs (so you can say things like
git clone me:my-project
rather thangit clone git@github.com:hoelzro/my-project
) -git-config
unfortunately doesn't handle insteadOf. If you want your function to work with these remote URLs, you can usegit ls-remote --get-url origin
instead.You might also want to use the
local
bash builtin to introducegit_url
andurl
as local variables to prevent your function from contaminating your bash session!Cool trick :). I have a bash alias
go='git browse'
that does the same using hub.github.com, but having the script on the dotfiles would be handy if I'm in a computer where its not available.Hi guys, this my own version for ssh and https, in one line, also you can run it in a subdirectory:
any tip on using two or more remotes (different credentials) on the same machine.. Let's say I use GitHub, my home NAS git and company's git server on the same machine for different projects... How to switch between these fast?
tips needed :) thanks in advance
You could just change your ssh config to use different identities based on the IP or something. If you need to use a different email, etc for certain projects you can use
git config user.email 'you@email.com'
(without--global
) to change it from the default global configuration.on Linux change
open
toxdg-open
or use
x-www-browser
in Ubuntuor use
sensible-browser
I've been using git-open and it has worked perfectly for me (even takes you to the current branch). Currently aliased to gh, though it also works with GitLab and Bitbucket.
npm install --global git-open
Bash scripts are great. Just wanted to point out there's a solid implementation of this though for those who want it.
I personally just use fugitive from VIM. If I ever need to see something from Github I just run
:Gbrowse
or if I want to just get the link to share it with someone I run:Gbrowse!
.Thanks for this. If you have GitHub Desktop installed - you may need to use a different alias.