All Projects → jdxcode → Gh

jdxcode / Gh

Licence: isc
Easily manage your local git repos

Programming Languages

shell
77523 projects
bash
514 projects

Projects that are alternatives of or similar to Gh

Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+2734.62%)
Mutual labels:  cli, zsh, fish
Kafkactl
Command Line Tool for managing Apache Kafka
Stars: ✭ 177 (+13.46%)
Mutual labels:  cli, zsh, fish
Gitmux
💻 Git in your tmux status bar
Stars: ✭ 180 (+15.38%)
Mutual labels:  cli, zsh, fish
Forgit
💤 A utility tool powered by fzf for using git interactively.
Stars: ✭ 1,823 (+1068.59%)
Mutual labels:  cli, zsh, fish
Fzf
🌸 A command-line fuzzy finder
Stars: ✭ 40,965 (+26159.62%)
Mutual labels:  cli, zsh, fish
Awesome Shell
A curated list of awesome command-line frameworks, toolkits, guides and gizmos. Inspired by awesome-php.
Stars: ✭ 22,631 (+14407.05%)
Mutual labels:  cli, zsh, fish
G
Simple go version manager, gluten-free
Stars: ✭ 307 (+96.79%)
Mutual labels:  cli, zsh, fish
Autocomplete
Autocomplete for terminals on MacOS
Stars: ✭ 569 (+264.74%)
Mutual labels:  cli, zsh, fish
Cgitc
Close Git Combat
Stars: ✭ 62 (-60.26%)
Mutual labels:  zsh, fish
Colorechoforshell
Make 🐚(shell) 's 💬 (`echo`) to be 🌈 easily ✨ Support ✅ sh ➕ bash ➕ zsh ➕ ksh ➕ 🐟
Stars: ✭ 75 (-51.92%)
Mutual labels:  zsh, fish
Vg
Virtualgo: Easy and powerful workspace based development for go
Stars: ✭ 1,213 (+677.56%)
Mutual labels:  zsh, fish
Dotfiles
🏠
Stars: ✭ 60 (-61.54%)
Mutual labels:  zsh, fish
Nord Konsole
An arctic, north-bluish clean and elegant Konsole color scheme.
Stars: ✭ 56 (-64.1%)
Mutual labels:  cli, zsh
Nostromo
CLI for building powerful aliases
Stars: ✭ 76 (-51.28%)
Mutual labels:  cli, zsh
Luneta
command-line fuzzy finder
Stars: ✭ 49 (-68.59%)
Mutual labels:  cli, zsh
Zsh to fish
How to make zsh like fish?
Stars: ✭ 93 (-40.38%)
Mutual labels:  zsh, fish
Mac Bootstrap
💻 Provision a new Mac for web development with dotfiles + Fish/Zsh, Neovim, and Tmux
Stars: ✭ 96 (-38.46%)
Mutual labels:  zsh, fish
Jump
Jump helps you navigate faster by learning your habits. ✌️
Stars: ✭ 1,024 (+556.41%)
Mutual labels:  zsh, fish
Nord Terminator
An arctic, north-bluish clean and elegant Terminator color theme.
Stars: ✭ 78 (-50%)
Mutual labels:  cli, zsh
Dotfiles
💻 Use command line interface manager for macOS configuration.
Stars: ✭ 97 (-37.82%)
Mutual labels:  cli, zsh

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.

Changing the base directory

gh will clone or cd into $GH_BASE_DIR/github.com/user/repo. By default $GH_BASE_DIR points to $HOME/src. By changing the $GH_BASE_DIR variable in your shell's config file, you can control where gh will clone/cd into.

Note: Already cloned repos will not be transferred to the new location, they will be cloned again.

More important Note: Do not use the tilde-character (~) in $GH_BASE_DIR, use $HOME instead.

Supported Shells

Installation for bash

echo 'source ~/src/github.com/jdxcode/gh/bash/gh.bash' >> ~/.bashrc
echo 'source ~/src/github.com/jdxcode/gh/completions/gh.bash' >> ~/.bashrc

Installation For Fish

Using oh-my-fish:

omf install gh

Using fisherman:

fisher jdxcode/gh

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

mkdir -p ~/src/github.com/jdxcode
git clone [email protected]:jdxcode/gh.git ~/src/github.com/jdxcode/gh
ln -s ~/src/github.com/jdxcode/gh/functions/gh.fish ~/.config/fish/functions/gh.fish
ln -s ~/src/github.com/jdxcode/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]=jdxcode

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

ln -s ~/src/github.com/jdxcode/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

The zsh autocompletion supports loading a user's repositories from github. For that to work, you need to set the environment variable GH_FETCH_REPOS to true. You will also need to install jsawk for it to work.

If you now type gh someusername and then press <Tab>, it will load that user's repositories from github and display them to you.

Note that, if autocompletion isn't working, then you probably need to make zsh refresh the completions dumpfile. Just remove the $HOME/.zcompdump-* file:

rm $HOME/.zcompdump-*

and reload the ~/.zshrc again to regenerate it.

For the bb (bitbucket) equivalent, repeat the above instructions, but substitute gh with bb, i.e.:

ln -s ~/src/github.com/jdxcode/gh/zsh/bb ~/.oh-my-zsh/custom/plugins/bb
plugins=(gh bb)
source ~/.zshrc

As before for GITHUB environment variable, the environment variable BITBUCKET is optional:

typeset +gx -A BITBUCKET
BITBUCKET[user]=jdxcode

Installation for zsh

Zsh supports bash autocomplete. You can add the following to your .zshrc but make sure you have compinit done first.

compinit
...
# bash completion and gh
autoload bashcompinit
bashcompinit
source ~/src/github.com/jdxcode/gh/bash/gh.bash
source ~/src/github.com/jdxcode/gh/completions/gh.bash

GitHub Alternatives

  • bb - bitbucket (fish)
  • gl - gitlab (fish, bash)

Go developers

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].