Better HN
topnewbestaskshowjobs
Log inSign up

Git-hub – Do GitHub operations from the git command(github.com)

71 points · by luu · 11y ago · 23 comments

Comments
TheHippo11y ago
Why should I favor this over Github's hub?

https://github.com/github/hub

jessedhillon11y ago
> hub is best aliased as git, so you can type $ git <command>

I'd rather have a git subcommand to interface with github. The way hub works is to alias over git and make it do github things by default. That seems like an obviously wrong way to do it.

jschwartzi11y ago
You could probably wrap it with another BASH script named git that looks for hub as $1, otherwise it passes its args directly into the git command. I haven't quite worked out how $PATH resolution would work in that scheme though.
jessedhillon11y ago
Git already works like this. If you attempt `git foo`, your $PATH will be consulted for an executable with the name `git-foo`, and if found, it will be called with the rest of the arguments. That's why this command is `git-hub` and is invoked with `git hub`.
fiatjaf11y ago
This is much more complete, and also you know when you are doing GitHub things and when you are doing Git things.
azdle11y ago
Wow, it's all written in bash. This has to be the biggest bash program (?) I've ever seen.
anonova11y ago
I think rvm [1] still holds that record for me.

[1]: https://github.com/rvm/rvm

rylee11y ago
Wait... rvm is pure bash?

Oh dear god. That's honestly terrifying. I've never bothered looking at it.

bdcravens11y ago
There was a crowd-sourcing campaign to re-write 2.0 in Ruby:

https://www.bountysource.com/teams/rvm/fundraiser

However, I haven't heard anything of it in a while.

Hello7111y ago

    $ cd rvm; find -type f -exec grep -l '#!.*bash' {} + | xargs wc -l | sort -n
    [ ... ]
       448 ./scripts/functions/selector_interpreters
       492 ./scripts/functions/gemset
       501 ./scripts/functions/requirements/osx_brew
       504 ./scripts/functions/selector
       589 ./scripts/functions/support
       681 ./scripts/gemsets
       684 ./scripts/mount
       886 ./binscripts/rvm-installer
      1100 ./scripts/cli
      1619 ./scripts/functions/installer
    $ wc -l /usr/portage/eclass/*.eclass | sort -n
    [ ... ]
       1299 /usr/portage/eclass/python-utils-r1.eclass
       1337 /usr/portage/eclass/kernel-2.eclass
       1528 /usr/portage/eclass/mysql.eclass
       1794 /usr/portage/eclass/eutils.eclass
       2265 /usr/portage/eclass/toolchain.eclass
       2771 /usr/portage/eclass/java-utils-2.eclass
       3181 /usr/portage/eclass/python.eclass
darkstar99911y ago
local Infinity=9999999
rcthompson11y ago
Didn't Sourcemage GNU/Linux write their entire package manager in bash?
skatenerd11y ago
How many people do you know who think that Git and GitHub are the same thing?
accatyyc11y ago
Quite a few. Especially our designers/people that doesn't commit/use git very much but still have to use it, have a hard time grasping the difference. The git client they're using being called "GitHub" doesn't make it any easier!
rcthompson11y ago
This is great. I was just looking for a way to merge pull requests from the command line today. (By which I mean fetch the branch into my local repo and perform the merge with git, not just having a bash script to press the merge button on Github.)
accatyyc11y ago
I hope this is very ironic (?)

edit removed unnecessary comment. What I mean is that you can already do this with git, nothing else required.

git remote add fork fork@github.com && git merge fork/pr-branch

gbtxg11y ago
Well actually you can do it without even adding a remote.

   git pull https://github.com/otheruser/repo.git branchname
so your example will become

    git pull fork@github.com pr-branch
rcthompson11y ago
Yeah, I want to do it without adding a remote for every person who sends a pull request. I presume this is git with the "hub" wrapper provided by github?

Oh, and I know I can pull directly from the appropriate URL, but I still have to browse to the pull request to get the URL for the associated branch. At that point I may as well just hit the merge button while I'm there.

fibo11y ago
I was really lucky I could met Ingy at a Perl conference. He is a really kind person and a mighty coder. He wrote also many other creative pieces of software, very powerful stuff like IO::All.

Ah, and he is the creator of YAML! Big respect!

ChristianBundy11y ago
https://github.com/ingydotnet/git-hub/issues/160
psophis11y ago
GitHub's hub is a wrapper for the git command. This adds a subcommand.

GitHub - ingydotnet/git-hub: Do GitHub operations from the `git` command

Do GitHub operations from the `git` command. Contribute to ingydotnet/git-hub development by creating an account on GitHub.

GitHub