• Stars
    star
    111
  • Rank 312,757 (Top 7 %)
  • Language
    Shell
  • Created almost 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Quickly navigate GitHub from the command line.

Git It On

A lot of times we have to look at files on GitHub. But this intrudes our ideal command-line workflow, having to switch to a browser and navigate to the URL. Wouldn't it be nice to just be able to open that file from the command line?

Git It On, the plugin for zshell, comes in here.

  • gitit -- open your current folder, on your current branch, in GitHub or GitLab
  • gitit <folder or file> -- opens that folder in your current branch (paths are relative)

Installation

Note: This plugin is stable, but still in active development. I do not yet consider this plugin finished.

Note: This was built on a Mac. Support for Linux is experimental, and has not been tested by the plugin author.

--

Oh-My-ZSH

Assuming you have oh-my-zsh, you can simply write

git clone https://github.com/peterhurford/git-it-on.zsh ~/.oh-my-zsh/custom/plugins/git-it-on
echo "plugins+=(git-it-on)" >> ~/.zshrc

(Alternatively, you can place the git-it-on plugin in the plugins=(...) local manually.)

--

Antigen

Add antigen bundle peterhurford/git-it-on.zsh to your .zshrc wherever you're adding the other antigen bundles.

Zgen

If youโ€™re using Zgen, add zgen load peterhurford/git-it-on.zsh to your .zshrc wherever you're adding your other zgen plugins.

Bash

If you're lame and use bash, you can install this directly to your ~/.bash_profile:

curl -s https://raw.githubusercontent.com/peterhurford/git-it-on.zsh/master/git-it-on.plugin.zsh >> ~/.bash_profile

Train Divider

That's cool... What else?

Well, for GitHub:

  • gitit <folder or file> <branch> -- opens that folder on the specified branch.
  • gitit repo <username> <reponame> -- opens up the specified repository.
  • gitit branch <branch> -- open the repo for a chosen branch.
  • gitit compare -- opens the compare file between your branch and master
  • gitit compare <branch> -- opens the compare file for a chosen branch (compared with master).
  • gitit commits -- opens the commits for your current branch
  • gitit commits <branch> -- opens the commits for a chosen branch.
  • gitit issues -- open the list of issues.
  • gitit history <filename> -- opens the github history page for the file.
  • gitit history <filename> <branch> -- opens the history page for the file on the chosen branch.
  • gitit pulls -- open the list of pull requests for the repo.
  • gitit pulls <filters> -- open the list of pull requests with filters (e.g., is:open, author:peterhurford)
  • gitit pulls <number> -- open the pull request for that number.
  • gitit branches all -- open up a list of all the branches in the repo.
  • gitit branches active -- open up a list of active branches.
  • gitit branches stale -- open up a list of stale branches.
  • gitit branches mine -- open up a list of your branches.
  • gitit grep <term> -- opens the github search page for your term
  • gitit ctrlp -- opens the github file finder for master branch (note that you cannot pass search terms directly from the command line)
  • gitit ctrlp <branch> -- opens the github file finder for your desired branch

And for GitLab:

  • gitit <folder or file> <branch> -- opens that folder on the specified branch.
  • gitit glcompare -- open a comparison for current branch to master
  • gitit glcompare <src> -- open a comparison for src to master
  • gitit glcompare <src> <target> -- open a comparison for src to target
  • gitit glcommits <file> -- open all commits; optionally specify file for all commits affecting it
  • gitit glbranches -- open the list of branches
  • gitit glhistory <file> <branch> -- open history of the current branch; optionally specify file and branch
  • gitit glmerges -- open merge requests page
  • gitit glmerges <query> -- open the list of pull requests with query (e.g. variable_1)
  • gitit glmerges <number> -- open page for merge request <number>
  • gitit glissues <query|number> -- similar to glmerges
  • gitit glctrlp <query> -- search using the gitlab file finder
  • gitit glnetwork -- open the GitLab repository graph

Gitlab Short Commands:

Gitlab commands also have short alternatives:
glcompare|glcm, glcommits|glco, glhistory|glh, glbranches|glb, glmerges|glm, glissues|gli, glctrlp|glcr, glnetwork|gln

But why even leave vim for the command line?

TODO: Make and link vim companion plugin.

These commands are too long, I want to be even faster!

You can make commands faster by using aliases. Put the following in your .zshrc (or .bash_profile)

#Gitit Aliases
alias myrepos="gitit repo peterhurford" #put your name here (usage: `myrepos <reponame>` to open up your repo.)
alias compare="gitit compare"
alias commits="gitit commits"
alias branch="gitit branch"
alias gistory="gitit history"
alias prs="gitit pulls"
alias myprs="gitit pulls author:peterhurford" #put your name here
alias mybranches="gitit branches mine"
alias gitgrep="gitit grep"
alias ctrlp="gitit ctrlp"

Feel free to change the aliases to whatever you'd like. You can even make them shorter, but the above is what I use. Note that these aliases are not included by default.

If you want more git-related aliases for making your git workflow faster, also look at my Git-aliases.zsh plugin.

Got any more plugins to share?

  • Send.zsh, a git command by robertzk that combines git add ., git commit -a -m, and git push origin <branch>.
  • Send.vim, a vim plugin by me to do the above without leaving vim.

More Repositories

1

git-aliases.zsh

Useful aliases for interacting with GitHub more quickly.
Shell
80
star
2

adv-r-book-solutions

Solutions for the Advanced R Development book
R
65
star
3

kaggle-toxic_comment

Code for Kaggle Jigsaw Toxic Comment, 34th / 4551 (Top 1%) Solution
Python
41
star
4

up.zsh

A zshell plugin for the "up" command, which can cd up an arbitrary number of directories
Shell
39
star
5

checkr

Automatic verification and testing of R functions
R
34
star
6

statsnotes

Notes on statistics
Python
33
star
7

vowpal_platypus

Fast, accurate, lightweight, multi-core ML in Python, leveraging Vowpal Wabbit
Python
22
star
8

64or32

A website to determine if your computer is 32-bit or 64-bit
JavaScript
16
star
9

kaggle-avito_demand

Code for the "Avito Demand Prediction" Kaggle Challenge
Jupyter Notebook
15
star
10

send.vim

Git add, git commit, git pull, git push all in one command, without leaving vim.
Vim Script
11
star
11

v_examples

Examples and benchmarks for using and testing Vowpal Platypus and VRhino
Python
8
star
12

batchman

A wrapper for R methods to run them in arbitrary batches.
R
7
star
13

pkgdeps

Find CRAN dependencies for R packages the easy way!
R
7
star
14

surveytools2

Surveytools2 is a collection of R functions that make working with dplyr on survey analysis just a little bit better.
R
7
star
15

personal

Personal Website
HTML
6
star
16

polygot-euler

Learn programming languages, write good code, and learn Math through Project Euler
R
5
star
17

gatsby

The Great Gatsby Text Adventure
JavaScript
4
star
18

rrzsh

Command line tools for R
Shell
4
star
19

funtools

Make R functions more fun
R
3
star
20

priority-wiki

JavaScript
3
star
21

priority-wiki-content

Content of the Priority Wiki
3
star
22

swapquote.vim

Minimalist vim plugin for swapping quotes
Vim Script
3
star
23

handlr

Handle errors better in R
R
3
star
24

currencyr

Convert various currencies into other currencies using the Fixer.io API.
R
3
star
25

macroutils.vim

Macros in vim that I commonly use, available as a vim plugin.
Vim Script
2
star
26

mystery_machine_learning

Mystery Machine Learning
JavaScript
2
star
27

rfm-example

Example of a high-speed, high-scale RFM model example in Python
Python
2
star
28

vimflow

Move around vim files like a real editor.
Vim Script
2
star
29

dotfiles

Dots!
Shell
2
star
30

kaggle-intersection

Code for 1st place Kaggle Intersection competition solution
Python
2
star
31

stargazr

A web application to determine ideal times and locations for Stargazing, using data from the internet.
Ruby
2
star
32

polygot-prolog

The 99 Prolog Problems, solved in several programming languages (but not Prolog)
R
1
star
33

games

Some notable (offline) games I've made and/or played over the years
1
star
34

s3cache

A persistant, cross-computer caching layer backed by the s3mpi package
R
1
star
35

yagpi2

Yet Another Github-Pivotal Integration
Ruby
1
star
36

blank_sinatra_site

A template for a website written in Sinatra.
Ruby
1
star
37

yagpi

Yet Another Github-Pivotal Integration. Obsoleted by YAGPI2.
Ruby
1
star
38

textdiff.zsh

Find the difference between two strings
Shell
1
star
39

ga_sen_runoff_polling

Open Model Project - 2020 Georgia Senate Runoff Polling
Jupyter Notebook
1
star
40

travelling_salesman

A genetic algorithm for the Travelling Salseman Problem
Python
1
star
41

peterhurford.github.io

Everyday Utilitarian
HTML
1
star
42

bassoons

Bassoon Production (MM2 Queue) Simulator
C++
1
star
43

tictactoe

Tic-tac-toe -- one of my first Ruby projects (don't judge) featuring a tic-tac-toe AI
Ruby
1
star
44

dencon

Website for the Denison Convention
JavaScript
1
star
45

strdate

Convert a relative time statement into a date
R
1
star
46

shinyview

Automatically open up R dataframes in Shiny
R
1
star
47

math-notes

My adventures on learning mathematics
1
star
48

acx_forecasts_2023

Forecasts for ACX's 2023 Question Set
Jupyter Notebook
1
star
49

loRem

Lorem Ipsum Generator for R
R
1
star
50

mlgear

Some utility functions to make ML with Python / Pandas / sklearn even easier
Python
1
star
51

surveytools

Surveytools is an old collection of R functions that, together, create a lightweight and modern workflow for analyzing survey data. It is obsoleted by Surveytools2.
R
1
star
52

dj-longread

Read the internet... on the internet
Jupyter Notebook
1
star