项目作者: qw3rtman

项目描述 :
Git Goodies: At-A-Glance, Efficient, and Aesthetically Pleasing Git Shortcuts
高级语言: Shell
项目地址: git://github.com/qw3rtman/gg.git
创建时间: 2015-03-02T02:05:34Z
项目社区:https://github.com/qw3rtman/gg

开源协议:MIT License

下载


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; a wrapper that adds functionality and is aesthetically pleasing.

Hold up. Aren’t these basically Git aliases?

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:

`gg s`

You can see the current local branch and its respective remote branch, the latest commit hash and message, the local repository’s position in relation with the respective remote repository (alerting you that you should push two commits to reach up-to-date status with the remote repository), the status of staging and commits, and the commits that waiting to be pushed.

All of this from one four character command.

Installation

Linux/OSX

  1. curl -fsSL git.io/gg.sh | bash

(HTTPS installation also available via curl -fsSL https://git.io/gg.sh | bash)

All this installation script does is download the gg script, make it an executable, and copy it to your $PATH (/usr/local/bin). For copying to your $PATH, it may require you to enter your password. If there is a better way to do this, please send in a pull request.

If you don’t feel comfortable executing a random script, its source is available here.

To take advantage of user-specific features (such as gg cl <your-repository>), make sure you git config --global --add gg.username <your-username>.

If you use oh-my-zsh, gg is already aliased to git gui citool. If you don’t use this alias, you can unalias it in your .zshrc file by adding unalias gg at the end of .zshrc.

gg relies solely on git and attempts to use built-in Shell features over external programs, such as using Bash substitution instead of sed.

Windows:

Note: This assumes that you already have the git installed on your system and
it is configured to be used on the command line.

  • Open a Command Prompt window and navigate to a folder included in your PATH.
  • Run the following commands
    1. powershell -Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/qw3rtman/gg/master/bin/gg', 'gg')"
    2. powershell -Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/qw3rtman/gg/master/bin/gg.cmd', 'gg.cmd')"
  • Open a new Command Prompt window and enjoy.

Usage

  1. usage:
  2. gg [options] [COMMAND] [args]
  3. commands:
  4. gg Display this help information
  5. gg i Initialize new Git repository
  6. gg ig List available .gitignore templates
  7. gg ig <template> Add .gitignore file from <template>
  8. gg igf <file ...> Add all <file>(s) to .gitignore
  9. gg cl <url> Clone repository from <url>
  10. gg a Add all files
  11. gg a <file ...> Add all <file>(s)
  12. gg c <message> Add all files and commit with <message>
  13. gg cn <message> Commit with <message>
  14. gg uc <count> Go back (uncommit) <count> commits
  15. gg rc <message> Add all files and recommit (amend) with <message>
  16. gg rcn <message> Recommit (amend) with <message>
  17. gg p Push all commits to remote
  18. gg pl Pull all commits from remote
  19. gg f Fetch all commits from remote
  20. gg s Display repository status
  21. gg l Display repository commit log
  22. gg b List all branches in repository
  23. gg b <branch> Create and checkout <branch>
  24. gg ch List all branches in repository
  25. gg ch <branch> Checkout <branch>
  26. gg in <hash> Display info about <hash>
  27. options:
  28. -V, --version Output current version of Git Goodies
  29. -h, --help Display this help information

Initializing repositories

`gg i`

  • gg i
  • gg init

Adding a template to .gitignore

`gg ig`

  • gg ig <template>
  • gg ignore <template>

Templates provided by .gitignore.io

Adding a file to .gitignore

`gg igf`

  • gg igf <file ...>
  • gg ignorefile <file ...>

Cloning a repository

`gg cl`

  • gg cl <url>
  • gg clone <url>

  • gg cl <github-username/repository>

  • gg clone <github-username/repository>

  • gg cl <your-repository> (if you have user-specific features enabled by git config --global --add gg.username <your-username>)

  • gg clone <your-repository> (if you have user-specific features enabled by git config --global --add gg.username <your-username>)

The URL can be provided in any format (SSH, HTTP, etc.)

Adding all files

`gg a`

  • gg a
  • gg add

Adding specific files

`gg a`

  • gg a <file ...>
  • gg add <file ...>

Adding all and committing

`gg c`

  • gg c <message>
  • gg commmit <message>

If no is provided, a generic one listing all files modified/added will be generated.

Committing

`gg cn`

  • gg cn <message>

If no is provided, a generic one listing all files modified/added will be generated.

Uncommiting (resetting: git reset HEAD~count)

`gg back`

  • gg uc <count>
  • gg uncommit <count>
  • gg back <count>

If no is provided, 1 will be used.

Adding all and recommitting (amending: git commit --amend)

`gg am`

  • gg rc <message>
  • gg recommit <message>
  • gg am <message>
  • gg amend <message>

If no is provided, a generic one listing all files modified/added will be generated.

Recommitting (amending: git commit --amend)

`gg am`

  • gg rcn <message>
  • gg amn <message>

If no is provided, a generic one listing all files modified/added will be generated.

Pushing

`gg p`

  • gg p
  • gg push

Pulling

`gg pl`

  • gg pl
  • gg pull

Fetching

`gg f`

  • gg f
  • gg fetch

Getting repository status

`gg s`

  • gg s
  • gg status

Displaying commit log

`gg l`

  • gg l
  • gg log

Listing all branches

`gg b`

  • gg b
  • gg ch

Checking out existing branch

`gg ch`

  • gg ch <branch>

Creating and checking out new branch

`gg b`

  • gg b <branch>

Displaying commit info

`gg in`

  • gg in <hash>
  • gg info <hash>
  • gg view <hash>

If no is provided, HEAD (last commit) will be used.

Displaying Git Goodies version

`gg -V`

  • gg -V
  • gg --version

Displaying Git Goodies help

`gg -h`

  • gg
  • gg -h
  • gg --help
  • gg help

Contributing

Contributions are always welcome, from a typo in the README to an enhancement of a feature to a completely new feature itself.

Avoid code smells, create reusable code, and follow the loosely-modeled coding standard found in the current code.

Fork the code, make a new branch, and send in a pull request.

See the TODO below for some contributions you can work on!

TODO

  • Integrate with GitHub (Issue #34)
  • Add pretty graphs (Issue #51)
  • Some form of persistent user profile (Issue #57)
  • Shortcut to quickly setup new repository (Issue #65)