项目作者: ricardobeat

项目描述 :
Custom power-user git commands.
高级语言: Shell
项目地址: git://github.com/ricardobeat/git-commands.git
创建时间: 2015-01-14T17:06:50Z
项目社区:https://github.com/ricardobeat/git-commands

开源协议:

下载


git-commands

A collection of useful git commands.

Installation

Clone the repo and add it to your PATH:

  1. git clone https://github.com/ricardobeat/git-commands ~/.git-commands
  2. echo export PATH="$PATH:$HOME/.git-commands" > ~/.zshrc # use .profile for bash

git author-stats

Output number of lines added / removed by author

  1. git author-stats Pietro
  2. Added: 116461, removed: 80818, total: 35643, modified: 197279 lines

git delete-merged-branches

Delete all branches that have already been merged into master.

git dig

Search for commits that include string in their change set.

  1. git dig new_feature_flag

git find

Find files containing the search strings, in any order. For example:

  1. git find modules main modal js
  2. main/lib/modules/modal/index.js

git grep-rank

Display authors of files containing string, ranked by frequency.

  1. homebrew-core git grep-rank dumb
  2. 10 matches for 'dumb'
  3. 5 s172262
  4. 3 Dominyk Tiller
  5. 1 Zhiming Wang
  6. 1 Fred McCann
  7. 1 David Holm

git open

Simultaneously open all changed files using $EDITOR, according to git status. Lets you pick up
work in progress without depending on editor ‘projects’ state.

git rank

Display ranking of authors by number of commits + extra stats.

git-rank

git remaster

While working in a branch, fetch latest master, then rebase current branch on top of that. Use
to keep in sync with main development branch.

git repush

Delete remote branch, then push again. To work around -f restrictions. Bails out if branch name is
master or trunk.

git shower

Run GC + prune. Optimized for a huge (~100k files) repository, might not work for you.

git size [commit]

Show the size in bytes introduced (or removed) by a specific commit. Accepts any ref identifier
that git understands: hashes, HEAD^, etc.

git snapshot [note]

Create a named stash, including an optional text note. This will not be featured in the stash list,
only in reflog (and will be GCed at some point). Use as safety checkpoints while furiously changing code.

git sort [hashes]

Sort a list of SHA1 commit hashes by their ordering in the history. Defaults to looking at the past 1000 commits,
can be overriden by setting the N environment var.

  1. git sort 2d5cbab63ba cf39029de04 61bdf05bbc1
  2. cf39029de04
  3. 61bdf05bbc1
  4. 2d5cbab63ba
  5. cat shas.txt | git sort
  6. cf39029de04
  7. 61bdf05bbc1
  8. ...

git stash-merge

Commands like git stash pop will refuse to apply over a dirty tree, even when an automatic merge is possible.

The stash-merge command will create a new stash object from your state and try to merge them together.

In case the the merge fails you still have both in stash list.