##The Cookbook of Git Goodies
gg
helps you work with git
more efficiently, saving you keystrokes for your most prized projects.
Think of gg
as a wrapper for the git
commands that you run all the time.
After the super painless installation, suppose we want to clone the awesome spark shell script (created by Zach Holman). Alright, let's switch into that directory. After making a quick change, let's check the status of our clone. Looks like we haven't staged our changes.
In the standard git workflow, we would have to git add -A
and then git commit -m "Updated example in README."
.
With gg
, we can simply gg c Updated example in README.
and we're good to go.
Let's check our clone's status again.
Looking good!
gg
can be installed via the Node Package Manager (npm
).
$ npm install -g gitgoodies
If that doesn't work, try running it as root. $ sudo npm install -g gitgoodies
You can also get up and running without npm, but it is not recommended to do so.
# Clone the repository.
$ git clone https://github.com/qw3rtman/gg.git
# Switch into the repository's directory.
$ cd gg
# Install!
$ npm install -g
# Install as root, if the above command does not work.
$ sudo npm install -g
gg
relies on Node.js and git
.
Don't foget to alias gg='noglob gg'
(alias gg
to noglob gg
) if you're using prezto, oh-my-zsh, or something similar.
As the standard git plugin for oh-my-zsh already has uses gg
as an alias for git gui citool
, I recommend either unaliasing the oh-my-zsh plugin alias if you don't use it by placing unalias gg
at the end of ~/.oh-my-zsh/plugins/git/git.plugin.zsh
, or aliasing gg
with a different alias, such as ggg
.
Changes are published to the npm package, which is kept up-to-date with this GitHub repository. Simply update via npm:
# Update gg
$ npm update -g gitgoodies
There's more to the package than just shortcuts or aliases.
For example, the gg s
command presents you with an easy to look at a quick glance status of your repository. In addition, there are aesthetic changes that increase the intuitiveness of Git itself.
Here's a screenshot of the gg s
command in action:
There's nothing special in Node that caused me to select it for this project. I wanted to get my feet wet with a new language and was recommended to try Node.
As Node is fairly popular (from what I've seen), I didn't think the issue of an extra dependency would exist.
In addition, I felt Node would widen the audience that could both understand and contribute to gg
, compared to Bash.
Also, Node is platform-agnostic, unlike Bash, which is only happy on Unix-based systems.
I'm using the zsh shell with the miloshadzic oh-my-zsh theme.
If you are having issues with how gg
looks and not the shell itself, please submit an issue and we'll attempt to solve the problem.
gg i
gg init
gg initialize
gg ig
gg ignore
gg ig java
gg ignore java
gg cl https://github.com/holman/spark.git
gg clone https://github.com/holman/spark.git
gg cl git@github.com:holman/spark.git
gg clone git@github.com:holman/spark.git
gg cl holman/spark
gg clone holman/spark
gg a
gg add
Add all files.
gg aa
gg c
gg ci
gg commit
gg p
gg push
gg pl
gg pull
gg f
gg fetch
Fetch all (git fetch -all
)
gg fa
gg s
gg st
gg status
gg l
gg log
gg b
gg branch
gg b new-branch
gg branch new-branch
gg ch
gg checkout
gg ch new-branch
gg checkout new-branch
Contributions are always welcome.
We follow Airbnb's coding standard, so make sure you use that as a guideline.
Fork our code, make a new branch, and send a pull request.
TODO:
- handling for merge conflicts
- support for specifying path of repository initialization and cloning
- unit tests
- custom routines
- check if directory is an existing Git repository or not
- proper colors, regardless of terminal colors/themes
- add verbose option (
gg pl v
, etc.) - switch over to libgit2
- undo last commit
- add custom files/directories to .gitignore