GithubHelp home page GithubHelp logo

dmreiland / gh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jdx/gh

0.0 2.0 0.0 2.18 MB

The best piece of code I've ever written.

Home Page: https://medium.com/@dickeyxxx/the-best-code-ive-ever-written-afaf96f49535

License: ISC License

JavaScript 12.77% Shell 87.23%

gh's Introduction

gh

gh allows you to very quickly navigate between GitHub project cloned on your local box. It will cd into project directories quickly and clone repos that do not exist.

There is a lot of mental overhead trying to manage a custom ~/src directory with your projects. I tried managing by work/personal, programming language, even tried a different directory for each month. I found by simply making your projects path reflect GitHub, it was much easier to remember where things were.

Here is a demo of me moving around various projects

demo

Usage

Clone and/or go to ~/src/github.com/githubuser/githubrepo.

gh githubuser githubrepo

It'll either just be a cd or it will clone [email protected]:githubuser/githubrepo.git

Note that tab completion is available for project and usernames.

Supported Shells

Installation For Fish

Using fisherman:

fisher dickeyxxx/gh

Alternatively, symlink (or copy) the function and completion files into $fish_function_path and $fish_complete_path

mkdir -p ~/src/github.com/dickeyxxx
git clone [email protected]:dickeyxxx/gh.git ~/src/github.com/dickeyxxx/gh
ln -s ~/src/github.com/dickeyxxx/gh/functions/gh.fish ~/.config/fish/functions/gh.fish
ln -s ~/src/github.com/dickeyxxx/gh/completions/gh.fish ~/.config/fish/completions/gh.fish

Installation For Oh-My-ZSH

Add this environment variable for your GitHub username (optional)

typeset +gx -A GITHUB
GITHUB[user]=dickeyxxx

Then symlink (or copy) the gh folder into your Oh-My-ZSH plugins folder

ln -s ~/src/github.com/dickeyxxx/gh/zsh/gh ~/.oh-my-zsh/custom/plugins/gh

Next add the plugin to your ~/.zshrc file

plugins=(gh)

For example:

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git brew meteor node npm osx redis-cli sublime gh)

Finally reload the ~/.zshrc file:

source ~/.zshrc

Installation for bash

echo 'source ~/src/github.com/dickeyxxx/gh/functions/gh.bash' >> ~/.bashrc

Go developers

This follows the standard convention for Go projects so long as you have your GOPATH set to ~.

gh's People

Contributors

sammorrowdrums avatar vertis avatar mando avatar patrick96 avatar

Watchers

Dan Reiland avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.