From 93d58ec74a015557af882d2d1fa696f63fea4052 Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 03:16:46 -0800 Subject: [PATCH 001/804] Initial Home page --- Home.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Home.md diff --git a/Home.md b/Home.md new file mode 100644 index 000000000..7b999f985 --- /dev/null +++ b/Home.md @@ -0,0 +1,10 @@ +# Install + +## Ubuntu + + $ sudo aptitude update + $ sudo aptitude install git-extras + +## Mac + + $ brew install git-extras \ No newline at end of file From 399073af7b23c23f85949b7506c2245847624939 Mon Sep 17 00:00:00 2001 From: CJ Date: Tue, 16 Dec 2014 20:12:06 +0800 Subject: [PATCH 002/804] Copy from git-goth https://github.com/chernjie/git-goth --- bin/git-scp | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100755 bin/git-scp diff --git a/bin/git-scp b/bin/git-scp new file mode 100755 index 000000000..45664e06e --- /dev/null +++ b/bin/git-scp @@ -0,0 +1,140 @@ +#!/usr/bin/env bash + +COLOR_RED() { echo -en "\033[31m"; } +COLOR_GREEN() { echo -en "\033[32m"; } +COLOR_YELLOW(){ echo -en "\033[33m"; } +COLOR_BLUE() { echo -en "\033[34m"; } +COLOR_RESET() { echo -en "\033[0m"; } + +function set_remote() +{ + remote=$1 + if [ $(git remote | grep -c ^$remote$) -eq 0 ] + then + echo "Remote $remote does not exist in your git config" + exit 1 + fi +} + +# Check file for PHP syntax errors +# takes a list of filenames +function php_lint() +{ + local error_count=() + for i + do + # check if file exists + # check if file ends with ".php" + if [ -f "$i" ] && [ "${i: -4}" == ".php" ] + then + php -l "$i" > /dev/null + [ $? -gt 0 ] && error_count[${#error_count[@]}]="$i" + fi + done + + # syntax check fails, force exit + [ ${#error_count[@]} -gt 0 ] && + COLOR_RED && + echo "Error: ${#error_count[@]} PHP syntax error found" && + echo "${error_count[@]}" | tr " " '\n' && + COLOR_RESET && + exit 255 + + echo -n +} + +function scp_and_stage +{ + set_remote $1 + shift + + local refhead="$(git rev-parse --quiet --verify $1)" + if [ -n "$refhead" ] + then + shift + [ $(git branch --contains "$refhead" | grep -c '\*') -eq 0 ] && + _error "refhead provided is not part of current branch" + fi + + if [ $# -ge 1 ] + then + list=$(git ls-files "$@")" "$(git ls-files -o "$@") + # list=$(echo "$@" | tr ' ' "\\n") + elif [ -n "$refhead" ] + then + git diff --stat $refhead + list=$(git diff $refhead --name-only) + else + git diff + list=$(git diff --name-only) + fi + + deleted=$(for i in $list; do [ -f $i ] || echo $i; done) + list=$(for i in $list; do [ -f $i ] && echo $i; done) + + if [ -n "$list" ] + then + _TMP=${0///} + echo "$list" > $_TMP && + php_lint $list && + echo Pushing to $remote \($(git config remote.$remote.url)\) && + (which dos2unix > /dev/null && dos2unix $list || echo > /dev/null) && + rsync -rlDv --files-from=$_TMP ./ "$(git config remote.$remote.url)/" && + git add $list && + rm $_TMP + fi + + deleted=$(for i in $deleted; do echo $(git config remote.$remote.url | cut -d: -f2)/$i; done) + + [ -n "$deleted" ] && + COLOR_RED && + echo Deleted files && + ssh $(git config remote.$remote.url | cut -d: -f1) -t rm $deleted && + echo "$deleted" + COLOR_RESET +} + +function reverse_scp() +{ + set_remote $1 + shift + + local _TMP=${0///} + echo $@ > $_TMP && + rsync -rlDv --files-from=$_TMP "$(git config remote.$remote.url)/" ./ && + rm $_TMP +} + +function _usage() +{ + echo "Usage: + git goth -h|help|? + git goth scp|stage [ref|file..] # scp and stage your files to specified remote + git goth scp|stage [] # show diff relative to and upload unstaged files to " + + case $1 in + -v|verbose|--verbose) grep -A100 '^#* OPTIONS #*$' $0;; + esac + exit +} + +function _error() +{ + [ $# -eq 0 ] && _usage && exit 0 + + echo + echo ERROR: "$@" + echo + exit 1 +} + +### OPTIONS ### +case $(basename $0) in + git-scp) + case $1 in + ''|-h|?|help|--help) shift; _usage $@;; + *) scp_and_stage $@;; + esac + ;; + git-rscp) reverse_scp $@;; +esac From 73d5209743ef89f584f1f1eabee6a940481f3404 Mon Sep 17 00:00:00 2001 From: CJ Date: Tue, 16 Dec 2014 21:26:18 +0800 Subject: [PATCH 003/804] adapted a more generic, customizable and friendly script --- bin/git-scp | 74 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 56 insertions(+), 18 deletions(-) diff --git a/bin/git-scp b/bin/git-scp index 45664e06e..6ae829807 100755 --- a/bin/git-scp +++ b/bin/git-scp @@ -6,12 +6,23 @@ COLOR_YELLOW(){ echo -en "\033[33m"; } COLOR_BLUE() { echo -en "\033[34m"; } COLOR_RESET() { echo -en "\033[0m"; } +function _test_git_scp() +{ + command -v rsync > /dev/null || _error requires rsync + command -v git > /dev/null || _error requires git + command -v ssh > /dev/null || _error requires ssh + command -v php > /dev/null || _info optional php + command -v dos2unix > /dev/null || _info optional dos2unix +} + function set_remote() { remote=$1 if [ $(git remote | grep -c ^$remote$) -eq 0 ] then + COLOR_RED echo "Remote $remote does not exist in your git config" + COLOR_RESET exit 1 fi } @@ -25,22 +36,42 @@ function php_lint() do # check if file exists # check if file ends with ".php" - if [ -f "$i" ] && [ "${i: -4}" == ".php" ] - then - php -l "$i" > /dev/null - [ $? -gt 0 ] && error_count[${#error_count[@]}]="$i" - fi + test ! -f "$i" && continue + case "$i" in + *\.php|*\.phtml) + php -l "$i" > /dev/null + [ $? -gt 0 ] && error_count[${#error_count[@]}]="$i" + ;; + esac done # syntax check fails, force exit - [ ${#error_count[@]} -gt 0 ] && + test ${#error_count[@]} -gt 0 && COLOR_RED && echo "Error: ${#error_count[@]} PHP syntax error found" && echo "${error_count[@]}" | tr " " '\n' && COLOR_RESET && exit 255 - echo -n + return 0 +} + +function _dos2unix() +{ + command -v dos2unix > /dev/null && dos2unix $@ + return 0 +} + +function _sanitize() +{ + git config --get-all extras.scp.sanitize | while read i + do + case $i in + php_lint) php_lint $@;; # git config --global --add extras.scp.sanitize php_lint + dos2unix) _dos2unix $@;; # git config --global --add extras.scp.sanitize dos2unix + esac + done + return $? } function scp_and_stage @@ -59,7 +90,6 @@ function scp_and_stage if [ $# -ge 1 ] then list=$(git ls-files "$@")" "$(git ls-files -o "$@") - # list=$(echo "$@" | tr ' ' "\\n") elif [ -n "$refhead" ] then git diff --stat $refhead @@ -74,11 +104,10 @@ function scp_and_stage if [ -n "$list" ] then - _TMP=${0///} + local _TMP=${0///} echo "$list" > $_TMP && - php_lint $list && - echo Pushing to $remote \($(git config remote.$remote.url)\) && - (which dos2unix > /dev/null && dos2unix $list || echo > /dev/null) && + _sanitize $list && + _info Pushing to $remote \($(git config remote.$remote.url)\) && rsync -rlDv --files-from=$_TMP ./ "$(git config remote.$remote.url)/" && git add $list && rm $_TMP @@ -88,8 +117,8 @@ function scp_and_stage [ -n "$deleted" ] && COLOR_RED && - echo Deleted files && - ssh $(git config remote.$remote.url | cut -d: -f1) -t rm $deleted && + echo Deleted remote files && + ssh $(git config remote.$remote.url | cut -d: -f1) -t "rm $deleted" && echo "$deleted" COLOR_RESET } @@ -105,12 +134,21 @@ function reverse_scp() rm $_TMP } +function _info() +{ + COLOR_YELLOW + test $# -gt 0 && echo "$@" + COLOR_RESET +} + function _usage() { echo "Usage: - git goth -h|help|? - git goth scp|stage [ref|file..] # scp and stage your files to specified remote - git goth scp|stage [] # show diff relative to and upload unstaged files to " + git scp -h|help|? + git scp [ref|file..] # scp and stage your files to specified remote + git scp [] # show diff relative to and upload unstaged files to + git rscp [] # copy files to current working directory + " case $1 in -v|verbose|--verbose) grep -A100 '^#* OPTIONS #*$' $0;; @@ -132,7 +170,7 @@ function _error() case $(basename $0) in git-scp) case $1 in - ''|-h|?|help|--help) shift; _usage $@;; + ''|-h|?|help|--help) shift; _test_git_scp; _usage $@;; *) scp_and_stage $@;; esac ;; From fc08a9a16586cb25e541e1a0c9b1616e2c434857 Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 06:50:27 -0800 Subject: [PATCH 004/804] Created Install (markdown) --- Install.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Install.md diff --git a/Install.md b/Install.md new file mode 100644 index 000000000..102dc180b --- /dev/null +++ b/Install.md @@ -0,0 +1,10 @@ +# Install + +## Debian + + $ sudo $apt_pref update + $ sudo $apt_pref install git-extras + +## Mac + + $ brew install git-extras \ No newline at end of file From 77502c79088cdf6db4d7c6d3b85660bd9caf9d7e Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 06:50:40 -0800 Subject: [PATCH 005/804] Updated Install (markdown) --- Install.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/Install.md b/Install.md index 102dc180b..dece9d19b 100644 --- a/Install.md +++ b/Install.md @@ -1,5 +1,3 @@ -# Install - ## Debian $ sudo $apt_pref update From 1b514d3cbc58dd977353748a97bceca2444fa9d9 Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 06:53:25 -0800 Subject: [PATCH 006/804] copy from readme --- Install.md | 8 -------- Installation.md | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) delete mode 100644 Install.md create mode 100644 Installation.md diff --git a/Install.md b/Install.md deleted file mode 100644 index dece9d19b..000000000 --- a/Install.md +++ /dev/null @@ -1,8 +0,0 @@ -## Debian - - $ sudo $apt_pref update - $ sudo $apt_pref install git-extras - -## Mac - - $ brew install git-extras \ No newline at end of file diff --git a/Installation.md b/Installation.md new file mode 100644 index 000000000..8ea2026ca --- /dev/null +++ b/Installation.md @@ -0,0 +1,24 @@ +## Debian + +```bash +$ sudo $apt_pref update +$ sudo $apt_pref install git-extras +``` + +## Mac + +```bash +$ brew install git-extras +``` + +## Clone / Tarball: + +```bash +$ make install +``` + +One-liner: + +```bash +$ (cd /tmp && git clone --depth 1 https://github.com/tj/git-extras.git && cd git-extras && sudo make install) +``` \ No newline at end of file From 15be9bb5ea0552e02e4170eb6cb27028bb82198f Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 06:56:31 -0800 Subject: [PATCH 007/804] add screencasts --- Home.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Home.md b/Home.md index 7b999f985..04802fb8c 100644 --- a/Home.md +++ b/Home.md @@ -1,10 +1,9 @@ -# Install +## Screencasts -## Ubuntu +Just getting started? Check out these screencasts: - $ sudo aptitude update - $ sudo aptitude install git-extras +* [introduction](https://vimeo.com/45506445) -- covering git-ignore, git-setup, git-changelog, git-release, git-effort and more -## Mac +## Installation - $ brew install git-extras \ No newline at end of file +See page [Installation](https://github.com/tj/git-extras/wiki/Installation). From fe618642eb37bbf0e4def246c6adf317eb6bf6e6 Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 07:06:38 -0800 Subject: [PATCH 008/804] add commands page, all copy & paste --- Commands.md | 669 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 669 insertions(+) create mode 100644 Commands.md diff --git a/Commands.md b/Commands.md new file mode 100644 index 000000000..a8cf8ed1a --- /dev/null +++ b/Commands.md @@ -0,0 +1,669 @@ + + - [`git extras`](#git-extras) + - `git squash` + - `git summary` + - `git effort` + - `git changelog` + - `git commits-since` + - `git count` + - `git create-branch` + - `git delete-branch` + - `git delete-submodule` + - `git delete-tag` + - `git delete-merged-branches` + - `git fresh-branch` + - `git graft` + - `git alias` + - `git ignore` + - `git info` + - `git fork` + - `git release` + - `git contrib` + - `git repl` + - `git undo` + - `git gh-pages` + - `git setup` + - `git touch` + - `git obliterate` + - `git feature` + - `git refactor` + - `git bug` + - `git local-commits` + - `git archive-file` + - `git missing` + - `git lock` + - `git locked` + - `git unlock` + - `git reset-file` + - `git pr` + - `git root` + +## git-extras + +The main `git-extras` command. + +Output the current `--version`: + +```bash +$ git extras +``` + +List available commands: + +```bash +$ git extras --help +``` + +Update to the latest `git-extras`: + +```bash +$ git extras update +``` +## git-gh-pages + +Sets up the `gh-pages` branch. (See [GitHub Pages](http://pages.github.com/) documentation.) + +## git-[feature|refactor|bug] [finish] <name> + +Create the given feature, refactor, or bug branch `name`: + +```bash +$ git feature dependencies +``` + +Afterwards, the same command will check it out: + +```bash +$ git checkout master +$ git feature dependencies +``` + +When finished, we can `feature finish` to merge it into the current branch: + +```bash +$ git checkout master +$ git feature finish dependencies +``` + +All of this works with `feature`, `bug`, or `refactor`. + +## git-contrib <author> + +Output `author`'s contributions to a project: + +```bash +$ git contrib visionmedia +visionmedia (18): + Export STATUS_CODES + Replaced several Array.prototype.slice.call() calls with Array.prototype.unshift.call() + Moved help msg to node-repl + Added multiple arg support for sys.puts(), print(), etc. + Fix stack output on socket error + ... +``` + +## git-summary + +Outputs a repo summary: + +```bash +$ git summary + +project : git-extras +repo age : 10 months ago +commits : 163 +active : 60 days +files : 93 +authors : + 97 Tj Holowaychuk 59.5% + 37 Jonhnny Weslley 22.7% + 8 Kenneth Reitz 4.9% + 5 Aggelos Orfanakos 3.1% + 3 Jonathan "Duke" Leto 1.8% + 2 Gert Van Gool 1.2% + 2 Domenico Rotiroti 1.2% + 2 Devin Withers 1.2% + 2 TJ Holowaychuk 1.2% + 1 Nick Campbell 0.6% + 1 Alex McHale 0.6% + 1 Jason Young 0.6% + 1 Jens K. Mueller 0.6% + 1 Guillermo Rauch 0.6% +``` + +This command can also take a *commitish*, and will print a summary for commits in +the commmitish range: + +```bash +$ git summary v42.. +``` + +This command can also take an options `--line`, will print a summary by lines + +```bash +$ git summary --line + +project : git-extras + lines : 8420 + authors : + 2905 Tj Holowaychuk 34.5% + 1901 Jonhnny Weslley 22.6% + 1474 nickl- 17.5% + 653 Leila Muhtasib 7.8% + 275 Tony 3.3% + 267 Jesús Espino 3.2% + 199 Philipp Klose 2.4% + 180 Michael Komitee 2.1% + 178 Tom Vincent 2.1% + 119 TJ Holowaychuk 1.4% + 114 Damian Krzeminski 1.4% + 66 Kenneth Reitz 0.8% + 22 Not Committed Yet 0.3% + 17 David Baumgold 0.2% + 12 Brian J Brennan 0.1% + 6 Leandro López 0.1% + 6 Jan Krueger 0.1% + 6 Gunnlaugur Thor Briem 0.1% + 3 Hogan Long 0.0% + 3 Curtis McEnroe 0.0% + 3 Alex McHale 0.0% + 3 Aggelos Orfanakos 0.0% + 2 Phally 0.0% + 2 NANRI 0.0% + 2 Moritz Grauel 0.0% + 1 Jean Jordaan 0.0% + 1 Daniel Schildt 0.0% +``` + +## git-effort [file ....] + + Displays "effort" statistics, currently just the number of commits per file, showing highlighting where the most activity is. The "active days" column is the total number of days which contributed modifications to this file. + +``` +node (master): git effort --above 15 {src,lib}/* +``` + + ![git effort](http://f.cl.ly/items/0b0w0S2K1d100e2T1a0D/Screen%20Shot%202012-02-08%20at%206.43.34%20PM.png) + + If you wish to ignore files with commits `<=` a value you may use `--above`: + +``` +$ git effort --above 5 +``` + + By default `git ls-files` is used, however you may pass one or more files to `git-effort(1)`, for example: + +``` +$ git effort bin/* lib/* +``` + +## git-repl + +GIT read-eval-print-loop: + +```bash +$ git repl + +git> ls-files +History.md +Makefile +Readme.md +bin/git-changelog +bin/git-count +bin/git-delete-branch +bin/git-delete-tag +bin/git-ignore +bin/git-release + +git> quit +``` + +## git-commits-since [date] + +List commits since `date` (defaults to "last week"): + +```bash +$ git commits-since +... changes since last week +TJ Holowaychuk - Fixed readme +TJ Holowaychuk - Added git-repl +TJ Holowaychuk - Added git-delete-tag +TJ Holowaychuk - Added git-delete-branch + +$ git commits-since yesterday +... changes since yesterday +TJ Holowaychuk - Fixed readme +``` + +## git-count + +Output commit count: + +```bash +$ git count + +total 1844 +``` + +Output detailed commit count: + +```bash +$ git count --all + +visionmedia (1285) +Tj Holowaychuk (430) +Aaron Heckmann (48) +csausdev (34) +ciaranj (26) +Guillermo Rauch (6) +Brian McKinney (2) +Nick Poulden (2) +Benny Wong (2) +Justin Lilly (1) +isaacs (1) +Adam Sanderson (1) +Viktor Kelemen (1) +Gregory Ritter (1) +Greg Ritter (1) +ewoudj (1) +James Herdman (1) +Matt Colyer (1) + +total 1844 +``` + +## git-fork + +Fork the given github <repo>. Like clone but forks first. + +```Shell +$ git fork https://github.com/LearnBoost/expect.js +``` + +or just: + +```Shell +$ git fork LearnBoost/expect.js +``` + +Does the following: +- forks the repo (prompts for github username and pass) +- clones the repo into the current directory +- adds the original repo as a remote so can track upstream changes +- all remotes refs use git over ssh + + +```Shell +$ cd expect.js && git remote -v +origin git@github.com:/expect.js (fetch) +origin git@github.com:/expect.js (push) +upstream git@github.com:LearnBoost/expect.js (fetch) +upstream git@github.com:LearnBoost/expect.js (push) +``` + + +## git-release + +Release commit with the given <tag>: + +```bash +$ git release 0.1.0 +``` + +Does the following: + + - Executes _.git/hooks/pre-release.sh_ (if present) + - Commits changes (to changelog etc) with message "Release <tag>" + - Tags with the given <tag> + - Push the branch / tags + - Executes _.git/hooks/post-release.sh_ (if present) + +## git-alias + +Define, search and show aliases. + +Define a new alias: + +```bash +$ git alias last "cat-file commit HEAD" +``` + +Search for aliases that match a pattern (one argument): + +```bash +$ git alias ^la +last = cat-file commit HEAD +``` + +Show all aliases (no arguments): + +```bash +$ git alias +s = status +amend = commit --amend +rank = shortlog -sn --no-merges +whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short +whois = !sh -c 'git log -i -1 --pretty="format:%an <%ae> +``` + +## git-ignore [pattern ...] + +Too lazy to open up `.gitignore`? Me too! + +```bash +$ git ignore build "*.o" "*.log" +... added 'build' +... added '*.o' +... added '*.log' +``` + +Without any patterns, `git-ignore` displays currently ignored patterns: + +```bash +$ git ignore +build +*.o +*.log +``` + +## git-info + +Show information about the repo: + +```bash +$ git info + + ## Remote URLs: + + origin git@github.com:sampleAuthor/git-extras.git (fetch) + origin git@github.com:sampleAuthor/git-extras.git (push) + + ## Remote Branches: + + origin/HEAD -> origin/master + origin/myBranch + + ## Local Branches: + + myBranch + * master + + ## Most Recent Commit: + + commit e3952df2c172c6f3eb533d8d0b1a6c77250769a7 + Author: Sample Author + + Added git-info command. + + Type 'git log' for more commits, or 'git show ' for full commit details. + + ## Configuration (.git/config): + + color.diff=auto + color.status=auto + color.branch=auto + user.name=Sample Author + user.email=sampleAuthor@gmail.com + core.repositoryformatversion=0 + core.filemode=true + core.bare=false + core.logallrefupdates=true + core.ignorecase=true + remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* + remote.origin.url=git@github.com:mub/git-extras.git + branch.master.remote=origin + branch.master.merge=refs/heads/master + +``` + +If you wish to omit the config section, you may use `--no-config`: + +```bash +$ git info --no-config +``` + +## git-create-branch <name> + +Create local and remote branch `name`: + +```bash +$ git create-branch development +``` + +## git-delete-branch <name> + +Delete local and remote branch `name`: + +```bash +$ git delete-branch integration +``` + +## git-delete-submodule <name> + +Delete submodule `name`: + +```bash +$ git delete-submodule lib/foo +``` + +## git-delete-tag <name> + +Delete local and remote tag `name`: + +```bash +$ git delete-tag 0.0.1 +``` + +## git-delete-merged-branches + +Deletes branches that are listed in `git branch --merged`. + +```bash +$ git delete-merged-branches +Deleted feature/themes (was c029ab3). +Deleted feature/live_preview (was a81b002). +Deleted feature/dashboard (was 923befa). +... +``` + +## git-fresh-branch <name> + +Create empty local branch `name`: + +```bash +$ git fresh-branch docs +``` + +## git-graft <src-branch> [dest-branch] + +Merge commits from `src-branch` into `dest-branch`. (`dest-branch` defaults to `master`.) + +```bash +$ git graft new_feature dev +$ git graft new_feature +``` + +## git-squash <src-branch|commit ref> [msg] + +Merge commits from `src-branch` into the current branch as a _single_ commit. +Also works if a commit reference from the current branch is provided. +When `[msg]` is given `git-commit(1)` will be invoked with that message. This is +useful when small individual commits within a topic branch are irrelevant and +you want to consider the topic as a single change. + +```bash +$ git squash fixed-cursor-styling +$ git squash fixed-cursor-styling "Fixed cursor styling" +$ git squash 95b7c52 +$ git squash HEAD~3 +$ git squash HEAD~3 "Work on a feature" +``` + +## git-changelog + +Populate a file whose name matches `change|history -i_` with commits +since the previous tag. (If there are no tags, populates commits since the project began.) + +Opens the changelog in `$EDITOR` when set. + +```bash +$ git changelog --tag 1.5.2 && cat History.md + +1.5.2 / 2010-08-05 +================== + +* Docs for git-ignore. Closes #3 +* Merge branch 'ignore' +* Added git-ignore +* Fixed in docs +* Install docs +* Merge branch 'release' +* Added git-release +* Passing args to git shortlog +* Added --all support to git-count +* Initial commit +``` + +List commits: + +```bash +$ git changelog --list + +* Docs for git-ignore. Closes #3 +* Merge branch 'ignore' +* Added git-ignore +* Fixed in docs +* Install docs +* Merge branch 'release' +* Added git-release +* Passing args to git shortlog +* Added --all support to git-count +* Initial commit +``` + +## git-undo + +Remove the latest commit: + +```bash +git undo +``` + +Remove the latest 3 commits: + +```bash +git undo 3 +``` + +## git-setup [dir] + +Set up a git repository (if one doesn't exist), add all files, and make an initial commit. `dir` defaults to the current working directory. + +## git-touch [filename] + +Call `touch` on the given file, and add it to the current index. One-step creation of new files. + +## git-obliterate [filename] + +Completely remove a file from the repository, including past commits and tags. + +```bash +git obliterate secrets.json +``` + +## git-local-commits + +List all commits on the local branch that have not yet been sent to origin. Any additional arguments will be passed directly to git log. + +## git-archive-file + +Creates an zip archive of the current git repository. The name of the archive will depend on the current HEAD of your git respository. + +## git-missing [branch1] branch2 + +Print out which commits are on one branch or the other but not both. + +```bash +$ git missing master +< d14b8f0 only on current checked out branch +> 97ef387 only on master +``` + +## git-rebase-patch patch-file + +Given a patch that doesn't apply to the current HEAD, find the latest commit +it applies to and do a rebase. For example: + +```bash +$ git rebase-patch test.patch +Trying to find a commit the patch applies to... +Patch applied to dbcf408dd26 as 7dc8b23ae1a +First, rewinding head to replay your work on top of it... +Applying: test.patch +Using index info to reconstruct a base tree... +Falling back to patching base and 3-way merge... +Auto-merging README.txt +``` + +## git-lock filename + +Lock a local file `filename`: + +```bash +$ git lock config/database.yml +``` + +## git-locked + +List local locked files: + +```bash +$ git locked +config/database.yml +``` + +## git-unlock filename + +Unlock a local file `filename` + +```bash +$ git unlock config/database.yml +``` + +## git-reset-file filename [commit] + +Reset one file to `HEAD` or certain commit + +Reset one file to HEAD + +```bash +$ git reset-file .htaccess +``` + +or reset one file to certain commit + +```bash +$ git reset-file .htaccess dc82b19 +``` + +## git-pr number + +Checks out a pull request from GitHub + +```bash +$ git pr 226 +From https://github.com/tj/git-extras + * [new ref] refs/pulls/226/head -> pr/226 +Switched to branch 'pr/226' +``` + +## git-root + +show the path to root directory of git repo + +```bash +$ pwd +.../very-deep-from-root-directory +$ cd `git root` +$ git add . && git commit +``` \ No newline at end of file From 866416b65e01d5193121c01fad351b0ef0092db7 Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 07:07:13 -0800 Subject: [PATCH 009/804] add commands page link --- Home.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Home.md b/Home.md index 04802fb8c..5f26e6aef 100644 --- a/Home.md +++ b/Home.md @@ -7,3 +7,7 @@ Just getting started? Check out these screencasts: ## Installation See page [Installation](https://github.com/tj/git-extras/wiki/Installation). + +## Commands + +See [Commands](https://github.com/tj/git-extras/wiki/Commands) page \ No newline at end of file From fdca066f90f6811576e85ab879f09d18ac2dc534 Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 07:09:25 -0800 Subject: [PATCH 010/804] adding links turn out to be a pain, go to sleep From 8585e0060d6a5eacfdade95dc4a0fa5b6fe63dde Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 07:16:19 -0800 Subject: [PATCH 011/804] gonna use the clean sub command for each command explanation --- Commands.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Commands.md b/Commands.md index a8cf8ed1a..e0550e767 100644 --- a/Commands.md +++ b/Commands.md @@ -1,6 +1,6 @@ - [`git extras`](#git-extras) - - `git squash` + - `git squash`(#git-squash) - `git summary` - `git effort` - `git changelog` @@ -38,7 +38,7 @@ - `git pr` - `git root` -## git-extras +## git extras The main `git-extras` command. From 67d48c768265a5596cbedad3ac4ab68ea925d093 Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 07:16:59 -0800 Subject: [PATCH 012/804] Updated Commands (markdown) --- Commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Commands.md b/Commands.md index e0550e767..293e00c56 100644 --- a/Commands.md +++ b/Commands.md @@ -483,7 +483,7 @@ $ git graft new_feature dev $ git graft new_feature ``` -## git-squash <src-branch|commit ref> [msg] +## git-squash Merge commits from `src-branch` into the current branch as a _single_ commit. Also works if a commit reference from the current branch is provided. From b46740bd33bd14ff1f703a27361bb8984ced45dc Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 07:17:15 -0800 Subject: [PATCH 013/804] Updated Commands (markdown) --- Commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Commands.md b/Commands.md index 293e00c56..3a221ded2 100644 --- a/Commands.md +++ b/Commands.md @@ -1,6 +1,6 @@ - [`git extras`](#git-extras) - - `git squash`(#git-squash) + - [`git squash`](#git-squash) - `git summary` - `git effort` - `git changelog` From 48f85b4039aaf5c6fd924ec266b47621d56d4662 Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 07:17:47 -0800 Subject: [PATCH 014/804] Updated Commands (markdown) --- Commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Commands.md b/Commands.md index 3a221ded2..3b3b1abce 100644 --- a/Commands.md +++ b/Commands.md @@ -483,7 +483,7 @@ $ git graft new_feature dev $ git graft new_feature ``` -## git-squash +## git squash Merge commits from `src-branch` into the current branch as a _single_ commit. Also works if a commit reference from the current branch is provided. From 0f5985889b861dec512c2cf61d6283371622d19b Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 07:39:26 -0800 Subject: [PATCH 015/804] roughly finished --- Commands.md | 168 ++++++++++++++++++++++++++-------------------------- 1 file changed, 83 insertions(+), 85 deletions(-) diff --git a/Commands.md b/Commands.md index 3b3b1abce..edfd4bffb 100644 --- a/Commands.md +++ b/Commands.md @@ -1,42 +1,40 @@ - [`git extras`](#git-extras) - [`git squash`](#git-squash) - - `git summary` - - `git effort` - - `git changelog` - - `git commits-since` - - `git count` - - `git create-branch` - - `git delete-branch` - - `git delete-submodule` - - `git delete-tag` - - `git delete-merged-branches` - - `git fresh-branch` - - `git graft` - - `git alias` - - `git ignore` - - `git info` - - `git fork` - - `git release` - - `git contrib` - - `git repl` - - `git undo` - - `git gh-pages` - - `git setup` - - `git touch` - - `git obliterate` - - `git feature` - - `git refactor` - - `git bug` - - `git local-commits` - - `git archive-file` - - `git missing` - - `git lock` - - `git locked` - - `git unlock` - - `git reset-file` - - `git pr` - - `git root` + - [`git summary`](#git-summary) + - [`git effort`](#git-effort) + - [`git changelog`](#git-changelog) + - [`git commits-since`](#git-commits-since) + - [`git count`](#git-count) + - [`git create-branch`](#git-create-branch) + - [`git delete-branch`](#git-delete-branch) + - [`git delete-submodule`](#git-delete-submodule) + - [`git delete-tag`](#git-delete-tag) + - [`git delete-merged-branches`](#git-delete-merged-branches) + - [`git fresh-branch`](#git-fresh-branch) + - [`git graft`](#git-graft) + - [`git alias`](#git-alias) + - [`git ignore`](#git-ignore) + - [`git info`](#git-info) + - [`git fork`](#git-fork) + - [`git release`](#git-release) + - [`git contrib`](#git-contrib) + - [`git repl`](#git-repl) + - [`git undo`](#git-undo) + - [`git gh-pages`](#git-gh-pages) + - [`git setup`](#git-setup) + - [`git touch`](#git-touch) + - [`git obliterate`](#git-obliterate) + - [`git feature|refactor|bug`](#git-feature|refactor|bug) + - [`git local-commits`](#git-local-commits) + - [`git archive-file`](#git-archive-file) + - [`git missing`](#git-missing) + - [`git lock`](#git-lock) + - [`git locked`](#git-locked) + - [`git unlock`](#git-unlock) + - [`git reset-file`](#git-reset-file) + - [`git pr`](#git-pr) + - [`git root`](#git-root) ## git extras @@ -59,11 +57,11 @@ Update to the latest `git-extras`: ```bash $ git extras update ``` -## git-gh-pages +## git gh-pages Sets up the `gh-pages` branch. (See [GitHub Pages](http://pages.github.com/) documentation.) -## git-[feature|refactor|bug] [finish] <name> +## git feature Create the given feature, refactor, or bug branch `name`: @@ -87,7 +85,7 @@ $ git feature finish dependencies All of this works with `feature`, `bug`, or `refactor`. -## git-contrib <author> +## git contrib Output `author`'s contributions to a project: @@ -102,7 +100,7 @@ visionmedia (18): ... ``` -## git-summary +## git summary Outputs a repo summary: @@ -115,20 +113,20 @@ commits : 163 active : 60 days files : 93 authors : - 97 Tj Holowaychuk 59.5% - 37 Jonhnny Weslley 22.7% - 8 Kenneth Reitz 4.9% - 5 Aggelos Orfanakos 3.1% - 3 Jonathan "Duke" Leto 1.8% - 2 Gert Van Gool 1.2% - 2 Domenico Rotiroti 1.2% - 2 Devin Withers 1.2% - 2 TJ Holowaychuk 1.2% - 1 Nick Campbell 0.6% - 1 Alex McHale 0.6% - 1 Jason Young 0.6% - 1 Jens K. Mueller 0.6% - 1 Guillermo Rauch 0.6% + 97 Tj Holowaychuk 59.5% + 37 Jonhnny Weslley 22.7% + 8 Kenneth Reitz 4.9% + 5 Aggelos Orfanakos 3.1% + 3 Jonathan "Duke" Leto 1.8% + 2 Gert Van Gool 1.2% + 2 Domenico Rotiroti 1.2% + 2 Devin Withers 1.2% + 2 TJ Holowaychuk 1.2% + 1 Nick Campbell 0.6% + 1 Alex McHale 0.6% + 1 Jason Young 0.6% + 1 Jens K. Mueller 0.6% + 1 Guillermo Rauch 0.6% ``` This command can also take a *commitish*, and will print a summary for commits in @@ -175,7 +173,7 @@ project : git-extras 1 Daniel Schildt 0.0% ``` -## git-effort [file ....] +## git effort Displays "effort" statistics, currently just the number of commits per file, showing highlighting where the most activity is. The "active days" column is the total number of days which contributed modifications to this file. @@ -197,7 +195,7 @@ $ git effort --above 5 $ git effort bin/* lib/* ``` -## git-repl +## git repl GIT read-eval-print-loop: @@ -218,7 +216,7 @@ bin/git-release git> quit ``` -## git-commits-since [date] +## git commits-since List commits since `date` (defaults to "last week"): @@ -235,7 +233,7 @@ $ git commits-since yesterday TJ Holowaychuk - Fixed readme ``` -## git-count +## git count Output commit count: @@ -272,7 +270,7 @@ Matt Colyer (1) total 1844 ``` -## git-fork +## git fork Fork the given github <repo>. Like clone but forks first. @@ -302,7 +300,7 @@ upstream git@github.com:LearnBoost/expect.js (push) ``` -## git-release +## git release Release commit with the given <tag>: @@ -318,7 +316,7 @@ Does the following: - Push the branch / tags - Executes _.git/hooks/post-release.sh_ (if present) -## git-alias +## git alias Define, search and show aliases. @@ -346,7 +344,7 @@ whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short whois = !sh -c 'git log -i -1 --pretty="format:%an <%ae> ``` -## git-ignore [pattern ...] +## git-ignore Too lazy to open up `.gitignore`? Me too! @@ -366,7 +364,7 @@ build *.log ``` -## git-info +## git info Show information about the repo: @@ -422,7 +420,7 @@ If you wish to omit the config section, you may use `--no-config`: $ git info --no-config ``` -## git-create-branch <name> +## git create-branch Create local and remote branch `name`: @@ -430,7 +428,7 @@ Create local and remote branch `name`: $ git create-branch development ``` -## git-delete-branch <name> +## git delete-branch Delete local and remote branch `name`: @@ -438,7 +436,7 @@ Delete local and remote branch `name`: $ git delete-branch integration ``` -## git-delete-submodule <name> +## git delete-submodule Delete submodule `name`: @@ -446,7 +444,7 @@ Delete submodule `name`: $ git delete-submodule lib/foo ``` -## git-delete-tag <name> +## git delete-tag Delete local and remote tag `name`: @@ -454,7 +452,7 @@ Delete local and remote tag `name`: $ git delete-tag 0.0.1 ``` -## git-delete-merged-branches +## git delete-merged-branches Deletes branches that are listed in `git branch --merged`. @@ -466,7 +464,7 @@ Deleted feature/dashboard (was 923befa). ... ``` -## git-fresh-branch <name> +## git-fresh-branch Create empty local branch `name`: @@ -474,7 +472,7 @@ Create empty local branch `name`: $ git fresh-branch docs ``` -## git-graft <src-branch> [dest-branch] +## git graft Merge commits from `src-branch` into `dest-branch`. (`dest-branch` defaults to `master`.) @@ -499,7 +497,7 @@ $ git squash HEAD~3 $ git squash HEAD~3 "Work on a feature" ``` -## git-changelog +## git changelog Populate a file whose name matches `change|history -i_` with commits since the previous tag. (If there are no tags, populates commits since the project began.) @@ -541,7 +539,7 @@ $ git changelog --list * Initial commit ``` -## git-undo +## git undo Remove the latest commit: @@ -555,15 +553,15 @@ Remove the latest 3 commits: git undo 3 ``` -## git-setup [dir] +## git setup Set up a git repository (if one doesn't exist), add all files, and make an initial commit. `dir` defaults to the current working directory. -## git-touch [filename] +## git touch Call `touch` on the given file, and add it to the current index. One-step creation of new files. -## git-obliterate [filename] +## git obliterate Completely remove a file from the repository, including past commits and tags. @@ -571,15 +569,15 @@ Completely remove a file from the repository, including past commits and tags. git obliterate secrets.json ``` -## git-local-commits +## git local-commits List all commits on the local branch that have not yet been sent to origin. Any additional arguments will be passed directly to git log. -## git-archive-file +## git archive-file Creates an zip archive of the current git repository. The name of the archive will depend on the current HEAD of your git respository. -## git-missing [branch1] branch2 +## git missing Print out which commits are on one branch or the other but not both. @@ -605,7 +603,7 @@ Falling back to patching base and 3-way merge... Auto-merging README.txt ``` -## git-lock filename +## git lock Lock a local file `filename`: @@ -613,7 +611,7 @@ Lock a local file `filename`: $ git lock config/database.yml ``` -## git-locked +## git locked List local locked files: @@ -622,7 +620,7 @@ $ git locked config/database.yml ``` -## git-unlock filename +## git unlock Unlock a local file `filename` @@ -630,7 +628,7 @@ Unlock a local file `filename` $ git unlock config/database.yml ``` -## git-reset-file filename [commit] +## git reset-file Reset one file to `HEAD` or certain commit @@ -646,7 +644,7 @@ or reset one file to certain commit $ git reset-file .htaccess dc82b19 ``` -## git-pr number +## git pr Checks out a pull request from GitHub @@ -657,7 +655,7 @@ From https://github.com/tj/git-extras Switched to branch 'pr/226' ``` -## git-root +## git root show the path to root directory of git repo @@ -666,4 +664,4 @@ $ pwd .../very-deep-from-root-directory $ cd `git root` $ git add . && git commit -``` \ No newline at end of file +``` From e300ddfdcc355f2d4d9f10848dce5d2a123c163c Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 07:51:42 -0800 Subject: [PATCH 016/804] some remaining dashes --- Commands.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Commands.md b/Commands.md index edfd4bffb..5a9ec431a 100644 --- a/Commands.md +++ b/Commands.md @@ -344,7 +344,7 @@ whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short whois = !sh -c 'git log -i -1 --pretty="format:%an <%ae> ``` -## git-ignore +## git ignore Too lazy to open up `.gitignore`? Me too! @@ -464,7 +464,7 @@ Deleted feature/dashboard (was 923befa). ... ``` -## git-fresh-branch +## git fresh-branch Create empty local branch `name`: @@ -587,7 +587,7 @@ $ git missing master > 97ef387 only on master ``` -## git-rebase-patch patch-file +## git rebase-patch Given a patch that doesn't apply to the current HEAD, find the latest commit it applies to and do a rebase. For example: From f8a62523391e1f4f2407f2a3c51a5637006ab2d1 Mon Sep 17 00:00:00 2001 From: timfeirg Date: Tue, 16 Dec 2014 19:13:52 -0800 Subject: [PATCH 017/804] add a few keywords --- Home.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Home.md b/Home.md index 5f26e6aef..c96d96298 100644 --- a/Home.md +++ b/Home.md @@ -6,8 +6,8 @@ Just getting started? Check out these screencasts: ## Installation -See page [Installation](https://github.com/tj/git-extras/wiki/Installation). +See [Installation](https://github.com/tj/git-extras/wiki/Installation) page. ## Commands -See [Commands](https://github.com/tj/git-extras/wiki/Commands) page \ No newline at end of file +Go to [Commands](https://github.com/tj/git-extras/wiki/Commands) page for basic usage and examples. \ No newline at end of file From af404cf6aee8f8302621efb25d9be46dff563289 Mon Sep 17 00:00:00 2001 From: hemanth Date: Tue, 16 Dec 2014 20:11:06 -0800 Subject: [PATCH 018/804] Added a footer. --- _Footer.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 _Footer.md diff --git a/_Footer.md b/_Footer.md new file mode 100644 index 000000000..d9b233ee2 --- /dev/null +++ b/_Footer.md @@ -0,0 +1 @@ +__GIT utilities__ -- repo summary, repl, changelog population, author commit percentages and more From 8259a0dcb451a8307793fcf47b011ac5772f51e0 Mon Sep 17 00:00:00 2001 From: CJ Date: Thu, 18 Dec 2014 15:14:52 +0800 Subject: [PATCH 019/804] First RFC documentation --- man/git-scp.1 | 191 +++++++++++++++++++++++++++++++++++++++++++++++ man/git-scp.html | 180 ++++++++++++++++++++++++++++++++++++++++++++ man/git-scp.md | 82 ++++++++++++++++++++ 3 files changed, 453 insertions(+) create mode 100644 man/git-scp.1 create mode 100644 man/git-scp.html create mode 100644 man/git-scp.md diff --git a/man/git-scp.1 b/man/git-scp.1 new file mode 100644 index 000000000..9a1c43f2c --- /dev/null +++ b/man/git-scp.1 @@ -0,0 +1,191 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-SCP" "1" "December 2014" "" "Git Extras" +. +.SH "NAME" +\fBgit\-scp\fR \- Copy files to SSH comptabile \fBgit\-remote\fR +. +.SH "SYNOPSIS" +. +.nf + +`git scp` \-h|help|? +`git scp` [\.\.\.|\.\.\.] +`git rscp` [] +. +.fi +. +.SH "DESCRIPTION" +A convenient way to copy files from the current working tree to the working directory of a remote repository\. If a \fB\.\.\.\fR is provided, only files that has changed within the commit range will be copied\. +. +.P +Internally this script uses \fBrsync\fR and not \fBscp\fR as the name suggests\. +. +.P +\fBgit\-rscp\fR \- Copies specific files from the working directory of a remote repository to the current working directory\. +. +.SH "OPTIONS" + +. +.IP "" 4 +. +.nf + +The git remote where you want to copy your files\. +. +.fi +. +.IP "" 0 +. +.P +\.\.\. +. +.IP "" 4 +. +.nf + +Any commit, commit range or tree\. Uses `git\-diff`(1) +. +.fi +. +.IP "" 0 +. +.P +\.\.\. +. +.IP "" 4 +. +.nf + +The parameters, when given, are used to limit the diff to the named paths (you can give directory names and get diff for all files under them)\. +. +.fi +. +.IP "" 0 +. +.SH "GIT CONFIGS" +To sanitize files using \fBdos2unix\fR before copying files +. +.IP "" 4 +. +.nf + +$ git config \-\-global \-\-add extras\.scp\.sanitize dos2unix +. +.fi +. +.IP "" 0 +. +.P +You can run the files through PHP lint (i\.e\. \fBphp \-l\fR) before copying files +. +.IP "" 4 +. +.nf + +$ git config \-\-global \-\-add extras\.scp\.sanitize php_lint +. +.fi +. +.IP "" 0 +. +.SH "EXAMPLES" +Make sure you have \fBgit\-remote\fR(1) setup +. +.IP "" 4 +. +.nf + +$ git remote add staging myStagingServer:/var/www/html +. +.fi +. +.IP "" 0 +. +.P +Copy unstaged files to remote +. +.IP "" 4 +. +.nf + +$ git scp staging +. +.fi +. +.IP "" 0 +. +.P +Copy staged and unstaged files to remote +. +.IP "" 4 +. +.nf + +$ git scp staging HEAD +. +.fi +. +.IP "" 0 +. +.P +Copy files that has been changed in the last commit, plus any staged or unstaged files to remote +. +.IP "" 4 +. +.nf + +$ git scp staging HEAD~1 +. +.fi +. +.IP "" 0 +. +.P +Copy files that has been changed between now and a tag +. +.IP "" 4 +. +.nf + +$ git scp staging v1\.2\.3 +. +.fi +. +.IP "" 0 +. +.P +Copy specific files +. +.IP "" 4 +. +.nf + +$ git scp staging index\.html \.gitignore \.htaccess +. +.fi +. +.IP "" 0 +. +.P +Copy specific directory +. +.IP "" 4 +. +.nf + +$ git scp staging js/vendor/ +. +.fi +. +.IP "" 0 +. +.SH "AUTHOR" +Written by Chern Jie <\fIlim@chernjie\.com\fR> +. +.SH "REPORTING BUGS" +<\fIhttps://github\.com/chernjie/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttps://github\.com/tj/git\-extras\fR> diff --git a/man/git-scp.html b/man/git-scp.html new file mode 100644 index 000000000..8e611c91b --- /dev/null +++ b/man/git-scp.html @@ -0,0 +1,180 @@ + + + + + + git-scp(1) - Copy files to SSH comptabile <code>git-remote</code> + + + + +
+ + + +
    +
  1. git-scp(1)
  2. +
  3. Git Extras
  4. +
  5. git-scp(1)
  6. +
+ +

NAME

+

+ git-scp - Copy files to SSH comptabile git-remote +

+ +

SYNOPSIS

+ +
`git scp` -h|help|?
+`git scp` <remote> [<commits>...|<path>...]
+`git rscp` <remote> [<path>]
+
+ +

DESCRIPTION

+ +

A convenient way to copy files from the current working tree to the working directory of a remote repository. If a <commits>... is provided, only files that has changed within the commit range will be copied.

+ +

Internally this script uses rsync and not scp as the name suggests.

+ +

git-rscp - Copies specific files from the working directory of a remote repository to the current working directory.

+ +

OPTIONS

+ +

<remote>

+ +
The git remote where you want to copy your files.
+
+ +

<commits>...

+ +
Any commit, commit range or tree. Uses `git-diff`(1)
+
+ +

<path>...

+ +
The <paths> parameters, when given, are used to limit the diff to the named paths (you can give directory names and get diff for all files under them).
+
+ +

GIT CONFIGS

+ +

To sanitize files using dos2unix before copying files

+ +
$ git config --global --add extras.scp.sanitize dos2unix
+
+ +

You can run the files through PHP lint (i.e. php -l) before copying files

+ +
$ git config --global --add extras.scp.sanitize php_lint
+
+ +

EXAMPLES

+ +

Make sure you have git-remote(1) setup

+ +
$ git remote add staging myStagingServer:/var/www/html
+
+ +

Copy unstaged files to remote

+ +
$ git scp staging
+
+ +

Copy staged and unstaged files to remote

+ +
$ git scp staging HEAD
+
+ +

Copy files that has been changed in the last commit, plus any staged or unstaged files to remote

+ +
$ git scp staging HEAD~1
+
+ +

Copy files that has been changed between now and a tag

+ +
$ git scp staging v1.2.3
+
+ +

Copy specific files

+ +
$ git scp staging index.html .gitignore .htaccess
+
+ +

Copy specific directory

+ +
$ git scp staging js/vendor/
+
+ +

AUTHOR

+ +

Written by Chern Jie <lim@chernjie.com>

+ +

REPORTING BUGS

+ +

<https://github.com/chernjie/git-extras/issues>

+ +

SEE ALSO

+ +

<https://github.com/tj/git-extras>

+ + +
    +
  1. +
  2. December 2014
  3. +
  4. git-scp(1)
  5. +
+ +
+ + diff --git a/man/git-scp.md b/man/git-scp.md new file mode 100644 index 000000000..a136bcdf1 --- /dev/null +++ b/man/git-scp.md @@ -0,0 +1,82 @@ +git-scp(1) -- Copy files to SSH comptabile `git-remote` +======================================================= + +## SYNOPSIS + + `git scp` -h|help|? + `git scp` [...|...] + `git rscp` [] + +## DESCRIPTION + +A convenient way to copy files from the current working tree to the working directory of a remote repository. If a `...` is provided, only files that has changed within the commit range will be copied. + +Internally this script uses `rsync` and not `scp` as the name suggests. + +`git-rscp` - Copies specific files from the working directory of a remote repository to the current working directory. + +## OPTIONS + + <remote> + + The git remote where you want to copy your files. + + <commits>... + + Any commit, commit range or tree. Uses `git-diff`(1) + + <path>... + + The parameters, when given, are used to limit the diff to the named paths (you can give directory names and get diff for all files under them). + +## GIT CONFIGS + + To sanitize files using `dos2unix` before copying files + + $ git config --global --add extras.scp.sanitize dos2unix + + You can run the files through PHP lint (i.e. `php -l`) before copying files + + $ git config --global --add extras.scp.sanitize php_lint + +## EXAMPLES + + Make sure you have `git-remote`(1) setup + + $ git remote add staging myStagingServer:/var/www/html + + Copy unstaged files to remote + + $ git scp staging + + Copy staged and unstaged files to remote + + $ git scp staging HEAD + + Copy files that has been changed in the last commit, plus any staged or unstaged files to remote + + $ git scp staging HEAD~1 + + Copy files that has been changed between now and a tag + + $ git scp staging v1.2.3 + + Copy specific files + + $ git scp staging index.html .gitignore .htaccess + + Copy specific directory + + $ git scp staging js/vendor/ + +## AUTHOR + +Written by Chern Jie <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> From 909072ad547e3ab849c8f8d270dcdc971fdf0310 Mon Sep 17 00:00:00 2001 From: CJ Date: Thu, 18 Dec 2014 15:45:35 +0800 Subject: [PATCH 020/804] Updated man page for git-scp --- man/git-scp.1 | 17 ++++++++++++++++- man/git-scp.html | 11 +++++++++-- man/git-scp.md | 8 +++++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/man/git-scp.1 b/man/git-scp.1 index 9a1c43f2c..8ca90adbe 100644 --- a/man/git-scp.1 +++ b/man/git-scp.1 @@ -104,7 +104,7 @@ $ git remote add staging myStagingServer:/var/www/html .IP "" 0 . .P -Copy unstaged files to remote +Copy unstaged files to remote\. Useful when you want to make quick test without making any commits . .IP "" 4 . @@ -181,6 +181,21 @@ $ git scp staging js/vendor/ . .IP "" 0 . +.P +Copy files from specific directory to multiple servers +. +.IP "" 4 +. +.nf + +$ for dest in web1 web2 web3; do + git diff \-\-name\-only 4\.8\.3 4\.8\.2 app/code/community app/design skin/ | xargs git scp $dest +done; +. +.fi +. +.IP "" 0 +. .SH "AUTHOR" Written by Chern Jie <\fIlim@chernjie\.com\fR> . diff --git a/man/git-scp.html b/man/git-scp.html index 8e611c91b..f09f6aaf4 100644 --- a/man/git-scp.html +++ b/man/git-scp.html @@ -126,7 +126,7 @@

EXAMPLES

$ git remote add staging myStagingServer:/var/www/html
 
-

Copy unstaged files to remote

+

Copy unstaged files to remote. Useful when you want to make quick test without making any commits

$ git scp staging
 
@@ -156,9 +156,16 @@

EXAMPLES

$ git scp staging js/vendor/
 
+

Copy files from specific directory to multiple servers

+ +
$ for dest in web1 web2 web3; do
+    git diff --name-only 4.8.3 4.8.2 app/code/community app/design skin/ | xargs git scp $dest
+done;
+
+

AUTHOR

-

Written by Chern Jie <lim@chernjie.com>

+

Written by Chern Jie <lim@chernjie.com>

REPORTING BUGS

diff --git a/man/git-scp.md b/man/git-scp.md index a136bcdf1..a13c9d3d5 100644 --- a/man/git-scp.md +++ b/man/git-scp.md @@ -45,7 +45,7 @@ Internally this script uses `rsync` and not `scp` as the name suggests. $ git remote add staging myStagingServer:/var/www/html - Copy unstaged files to remote + Copy unstaged files to remote. Useful when you want to make quick test without making any commits $ git scp staging @@ -69,6 +69,12 @@ Internally this script uses `rsync` and not `scp` as the name suggests. $ git scp staging js/vendor/ + Copy files from specific directory to multiple servers + + $ for dest in web1 web2 web3; do + git diff --name-only 4.8.3 4.8.2 app/code/community app/design skin/ | xargs git scp $dest + done; + ## AUTHOR Written by Chern Jie <> From 158266684debf07ccd458f10d50d148fad298417 Mon Sep 17 00:00:00 2001 From: CJ Date: Sun, 28 Dec 2014 23:53:49 +1100 Subject: [PATCH 021/804] OMG a spelling mistake\! --- man/git-scp.1 | 2 +- man/git-scp.html | 4 ++-- man/git-scp.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/man/git-scp.1 b/man/git-scp.1 index 8ca90adbe..1b53d9c49 100644 --- a/man/git-scp.1 +++ b/man/git-scp.1 @@ -4,7 +4,7 @@ .TH "GIT\-SCP" "1" "December 2014" "" "Git Extras" . .SH "NAME" -\fBgit\-scp\fR \- Copy files to SSH comptabile \fBgit\-remote\fR +\fBgit\-scp\fR \- Copy files to SSH compatible \fBgit\-remote\fR . .SH "SYNOPSIS" . diff --git a/man/git-scp.html b/man/git-scp.html index f09f6aaf4..2a9ed2f85 100644 --- a/man/git-scp.html +++ b/man/git-scp.html @@ -3,7 +3,7 @@ - git-scp(1) - Copy files to SSH comptabile <code>git-remote</code> + git-scp(1) - Copy files to SSH compatible <code>git-remote</code> + + + +
+ + + +
    +
  1. git-chore(1)
  2. +
  3. +
  4. git-chore(1)
  5. +
+ +

NAME

+

+ git-chore - Create chore branch +

+ +

SYNOPSIS

+ +

git-chore [finish] <name>

+ +

DESCRIPTION

+ +

Create the given chore branch

+ +

OPTIONS

+ +

<finish>

+ +

Merge and delete the chore branch.

+ +

<name>

+ +

The name of the chore branch.

+ +

EXAMPLES

+ +
$ git chore chore-123456
+...
+$ git commit -m "Some changes"
+...
+$ git checkout master
+$ git chore finish chore-123456
+
+ +

AUTHOR

+ +

Written by Chris Hall <christopher.k.hall@gmail.com> from bug/feature/refactor comamnds originally written by Jesús Espino <jespinog@gmail.com>

+ +

REPORTING BUGS

+ +

<https://github.com/tj/git-extras/issues>

+ +

SEE ALSO

+ +

<https://github.com/tj/git-extras>

+ + +
    +
  1. +
  2. February 2015
  3. +
  4. git-chore(1)
  5. +
+ +
+ + diff --git a/man/git-chore.md b/man/git-chore.md new file mode 100644 index 000000000..544c7811b --- /dev/null +++ b/man/git-chore.md @@ -0,0 +1,41 @@ +git-chore(1) -- Create chore branch +=============================== + +## SYNOPSIS + +`git-chore` [finish] <name> + +## DESCRIPTION + + Create the given chore branch + +## OPTIONS + + <finish> + + Merge and delete the chore branch. + + <name> + + The name of the chore branch. + +## EXAMPLES + + $ git chore chore-123456 + ... + $ git commit -m "Some changes" + ... + $ git checkout master + $ git chore finish chore-123456 + +## AUTHOR + +Written by Chris Hall <> from bug/feature/refactor comamnds originally written by Jesús Espino <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> From 32aee50bc6077bfcbd5cc80b3ceaef25d0adc9a5 Mon Sep 17 00:00:00 2001 From: spacewander Date: Thu, 5 Feb 2015 14:22:49 +0800 Subject: [PATCH 029/804] extra mktemp into git_extra_mktemp now we can put all utility functions to git-extra-utility --- Makefile | 7 +++++-- bin/git-changelog | 2 +- bin/git-effort | 2 +- bin/git-rebase-patch | 2 +- helper/git-extra-utility | 7 +++++++ 5 files changed, 15 insertions(+), 5 deletions(-) create mode 100755 helper/git-extra-utility diff --git a/Makefile b/Makefile index a0d8576d9..d3a6a6401 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ BINS = $(wildcard bin/git-*) MANS = $(wildcard man/git-*.md) MAN_HTML = $(MANS:.md=.html) MAN_PAGES = $(MANS:.md=.1) +LIB = "helper/git-extra-utility" COMMANDS_USED_WITHOUT_GIT_REPO = git-alias git-extras git-fork git-setup COMMANDS_USED_WITH_GIT_REPO = $(filter-out $(COMMANDS_USED_WITHOUT_GIT_REPO), \ @@ -22,13 +23,15 @@ install: @chmod 775 $(TEMPFILE) @$(foreach COMMAND, $(COMMANDS_USED_WITH_GIT_REPO), \ echo "... installing $(COMMAND)"; \ - head -1 bin/$(COMMAND) | cat - ./helper/is-git-repo > $(TEMPFILE); \ + head -1 bin/$(COMMAND) | cat - $(LIB) ./helper/is-git-repo > $(TEMPFILE); \ tail -n +2 bin/$(COMMAND) >> $(TEMPFILE); \ cp -f $(TEMPFILE) $(DESTDIR)$(BINPREFIX)/$(COMMAND); \ ) @$(foreach COMMAND, $(COMMANDS_USED_WITHOUT_GIT_REPO), \ echo "... installing $(COMMAND)"; \ - cp -f bin/$(COMMAND) $(DESTDIR)$(BINPREFIX); \ + head -1 bin/$(COMMAND) | cat - $(LIB) > $(TEMPFILE); \ + tail -n +2 bin/$(COMMAND) >> $(TEMPFILE); \ + cp -f $(TEMPFILE) $(DESTDIR)$(BINPREFIX)/$(COMMAND); \ ) @if [ -z "$(wildcard man/git-*.1)" ]; then \ echo "WARNING: man pages not created, use 'make docs' (which requires 'ronn' ruby lib)"; \ diff --git a/bin/git-changelog b/bin/git-changelog index 096d73286..d2b263997 100755 --- a/bin/git-changelog +++ b/bin/git-changelog @@ -47,7 +47,7 @@ if test "$CHANGELOG" = ""; then CHANGELOG='History.md'; fi fi -tmp=`mktemp -t $(basename $0).XXX` +tmp=$(git_extra_mktemp) printf "$HEAD" > $tmp git-changelog $GIT_LOG_OPTS --list >> $tmp printf '\n\n' >> $tmp diff --git a/bin/git-effort b/bin/git-effort index 6da4f79d2..4fb298165 100755 --- a/bin/git-effort +++ b/bin/git-effort @@ -1,6 +1,6 @@ #!/usr/bin/env bash -tmp=`mktemp -t $(basename $0)` +tmp=$(git_extra_mktemp) above='0' color= diff --git a/bin/git-rebase-patch b/bin/git-rebase-patch index 6e7681e77..08350527f 100755 --- a/bin/git-rebase-patch +++ b/bin/git-rebase-patch @@ -15,7 +15,7 @@ then fi # Use a temporary index. -index=`mktemp -t $(basename $0)` +index=$(git_extra_mktemp) cleanup() { rm $index exit 2 diff --git a/helper/git-extra-utility b/helper/git-extra-utility new file mode 100755 index 000000000..98ed09f4c --- /dev/null +++ b/helper/git-extra-utility @@ -0,0 +1,7 @@ +# put all utility functions here + +# make a temporary file +git_extra_mktemp() { + mktemp -t "$(basename "$0")".XXX +} + From 0325c46a4389b319c71405192207b08e56d68898 Mon Sep 17 00:00:00 2001 From: CJ Date: Thu, 5 Feb 2015 18:23:37 +0800 Subject: [PATCH 030/804] tj#300 Added bash completion --- etc/bash_completion.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index 342c4d58d..7517c6857 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -78,6 +78,14 @@ _git_refactor(){ __git_extras_workflow "refactor" } +_git_scp(){ + __git_complete_remote_or_refspec +} + +_git_rscp(){ + __git_complete_remote_or_refspec +} + _git_squash(){ __gitcomp "$(__git_heads)" } From dae7399f7ee1806bd687d54073bc7f9f1c331609 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Fri, 6 Feb 2015 15:47:49 -0500 Subject: [PATCH 031/804] Updated Commands (markdown) --- Commands.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Commands.md b/Commands.md index 14f785bc8..0c02ed113 100644 --- a/Commands.md +++ b/Commands.md @@ -4,6 +4,7 @@ - [`git summary`](#git-summary) - [`git effort`](#git-effort) - [`git changelog`](#git-changelog) + - [`git chore`](#git-chore) - [`git commits-since`](#git-commits-since) - [`git count`](#git-count) - [`git create-branch`](#git-create-branch) From 104e953dd301e6e051f8282824350f563ce1244d Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Fri, 6 Feb 2015 15:48:20 -0500 Subject: [PATCH 032/804] Updated Commands (markdown) --- Commands.md | 1 - 1 file changed, 1 deletion(-) diff --git a/Commands.md b/Commands.md index 0c02ed113..14f785bc8 100644 --- a/Commands.md +++ b/Commands.md @@ -4,7 +4,6 @@ - [`git summary`](#git-summary) - [`git effort`](#git-effort) - [`git changelog`](#git-changelog) - - [`git chore`](#git-chore) - [`git commits-since`](#git-commits-since) - [`git count`](#git-count) - [`git create-branch`](#git-create-branch) From 50650ec314247b8dd3963c253b649c96e644145f Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Fri, 6 Feb 2015 15:48:40 -0500 Subject: [PATCH 033/804] Updated Commands (markdown) --- Commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Commands.md b/Commands.md index 14f785bc8..1017aeb5f 100644 --- a/Commands.md +++ b/Commands.md @@ -25,7 +25,7 @@ - [`git setup`](#git-setup) - [`git touch`](#git-touch) - [`git obliterate`](#git-obliterate) - - [`git feature|refactor|bug`](#git-feature) + - [`git feature|refactor|bug|chore`](#git-feature) - [`git local-commits`](#git-local-commits) - [`git archive-file`](#git-archive-file) - [`git missing`](#git-missing) From ee543f184a5fa2e70f872909edcf3e07438f58a2 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Fri, 6 Feb 2015 15:49:26 -0500 Subject: [PATCH 034/804] Updated Commands (markdown) --- Commands.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Commands.md b/Commands.md index 1017aeb5f..a34674d90 100644 --- a/Commands.md +++ b/Commands.md @@ -61,9 +61,9 @@ $ git extras update Sets up the `gh-pages` branch. (See [GitHub Pages](http://pages.github.com/) documentation.) -## git feature +## git feature / refactor / bug / chore -Create the given feature, refactor, or bug branch `name`: +Create the given feature, refactor, bug or chore branch `name`: ```bash $ git feature dependencies From cb2aa2792fc09128fbeca9ea250295eaf4af33a1 Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Fri, 6 Feb 2015 15:50:25 -0500 Subject: [PATCH 035/804] Updated Commands (markdown) --- Commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Commands.md b/Commands.md index a34674d90..452d87970 100644 --- a/Commands.md +++ b/Commands.md @@ -61,7 +61,7 @@ $ git extras update Sets up the `gh-pages` branch. (See [GitHub Pages](http://pages.github.com/) documentation.) -## git feature / refactor / bug / chore +## git feature Create the given feature, refactor, bug or chore branch `name`: From b0a6d04f9ff303a9864070eda45c7309e3789ad4 Mon Sep 17 00:00:00 2001 From: wooorm Date: Sat, 7 Feb 2015 14:01:45 +0100 Subject: [PATCH 036/804] Add git-authors --- bin/git-authors | 35 +++++++++++ etc/bash_completion.sh | 3 + man/git-authors.1 | 61 +++++++++++++++++++ man/git-authors.html | 135 +++++++++++++++++++++++++++++++++++++++++ man/git-authors.md | 50 +++++++++++++++ 5 files changed, 284 insertions(+) create mode 100755 bin/git-authors create mode 100644 man/git-authors.1 create mode 100644 man/git-authors.html create mode 100644 man/git-authors.md diff --git a/bin/git-authors b/bin/git-authors new file mode 100755 index 000000000..194a64ba0 --- /dev/null +++ b/bin/git-authors @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +LIST=false +FILE="" + +if test "$1" = "-l" || test "$1" = "--list"; then + LIST=true +else + FILE=$1 + if test "$FILE" = ""; then + FILE=`ls | egrep 'authors|contributors' -i|head -n1` + if test "$FILE" = ""; then + FILE='AUTHORS' + fi + fi +fi + +# +# list authors sorted by number of commits (descending). +# + +authors() { + git shortlog -sne | awk '{$1=""; sub(" ", ""); print}' +} + +# +# authors. +# + +if $LIST; then + echo "$(authors)" +else + authors >> $FILE + test -n "$EDITOR" && $EDITOR $FILE +fi diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index 3c6dffc9f..8280155be 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -10,6 +10,9 @@ _git_changelog(){ _git_chore(){ __git_extras_workflow "chore" + +_git_authors(){ + __gitcomp "-l --list" } _git_contrib(){ diff --git a/man/git-authors.1 b/man/git-authors.1 new file mode 100644 index 000000000..9142fce77 --- /dev/null +++ b/man/git-authors.1 @@ -0,0 +1,61 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-AUTHORS" "1" "February 2015" "" "Git Extras" +. +.SH "NAME" +\fBgit\-authors\fR \- Generate authors report +. +.SH "SYNOPSIS" +\fBgit\-authors\fR [\-l, \-\-list] +. +.SH "DESCRIPTION" +Populates the file matching \fIauthors|contributors \-i\fR with the authors of commits, according to the number of commits per author\. Opens the file in \fB$EDITOR\fR when set\. +. +.P +See the "MAPPING AUTHORS" section of \fBgit\-shortlog\fR(1) to coalesce together commits by the same person\. +. +.SH "OPTIONS" +\-l, \-\-list +. +.P +Show authors\. +. +.SH "EXAMPLES" +. +.TP +Updating AUTHORS file: +. +.IP +$ git authors +. +.TP +Listing authors: +. +.IP +$ git authors \-\-list +. +.IP "" 4 +. +.nf + +TJ Holowaychuk +Tj Holowaychuk +hemanth\.hm +Jonhnny Weslley +nickl\- +Leila Muhtasib +. +.fi +. +.IP "" 0 + +. +.SH "AUTHOR" +Written by Titus Wormer <\fItituswormer@gmail\.com\fR> +. +.SH "REPORTING BUGS" +<\fIhttps://github\.com/tj/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttps://github\.com/tj/git\-extras\fR> diff --git a/man/git-authors.html b/man/git-authors.html new file mode 100644 index 000000000..cb7fee91e --- /dev/null +++ b/man/git-authors.html @@ -0,0 +1,135 @@ + + + + + + git-authors(1) - Generate authors report + + + + +
+ + + +
    +
  1. git-authors(1)
  2. +
  3. Git Extras
  4. +
  5. git-authors(1)
  6. +
+ +

NAME

+

+ git-authors - Generate authors report +

+ +

SYNOPSIS

+ +

git-authors [-l, --list]

+ +

DESCRIPTION

+ +

Populates the file matching authors|contributors -i with the authors of commits, according to the number of commits per author. + Opens the file in $EDITOR when set.

+ +

See the "MAPPING AUTHORS" section of git-shortlog(1) to coalesce together commits by the same person.

+ +

OPTIONS

+ +

-l, --list

+ +

Show authors.

+ +

EXAMPLES

+ +
+
Updating AUTHORS file:

+ +

$ git authors

+
Listing authors:

+ +

$ git authors --list

+ +
TJ Holowaychuk <tj@vision-media.ca>
+Tj Holowaychuk <tj@vision-media.ca>
+hemanth.hm <hemanth.hm@gmail.com>
+Jonhnny Weslley <jw@jonhnnyweslley.net>
+nickl- <github@jigsoft.co.za>
+Leila Muhtasib <muhtasib@gmail.com>
+
+
+ + +

AUTHOR

+ +

Written by Titus Wormer <tituswormer@gmail.com>

+ +

REPORTING BUGS

+ +

<https://github.com/tj/git-extras/issues>

+ +

SEE ALSO

+ +

<https://github.com/tj/git-extras>

+ + +
    +
  1. +
  2. February 2015
  3. +
  4. git-authors(1)
  5. +
+ +
+ + diff --git a/man/git-authors.md b/man/git-authors.md new file mode 100644 index 000000000..8ff4943a3 --- /dev/null +++ b/man/git-authors.md @@ -0,0 +1,50 @@ +git-authors(1) -- Generate authors report +================================================= + +## SYNOPSIS + +`git-authors` [-l, --list] + +## DESCRIPTION + + Populates the file matching _authors|contributors -i_ with the authors of commits, according to the number of commits per author. + Opens the file in **$EDITOR** when set. + + See the "MAPPING AUTHORS" section of **git-shortlog**(1) to coalesce together commits by the same person. + +## OPTIONS + + -l, --list + + Show authors. + +## EXAMPLES + + * Updating AUTHORS file: + + $ git authors + + * Listing authors: + + $ git authors --list + + ``` + TJ Holowaychuk + Tj Holowaychuk + hemanth.hm + Jonhnny Weslley + nickl- + Leila Muhtasib + ``` + +## AUTHOR + +Written by Titus Wormer <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> From 0fd45396ce59b6cb2b57ef3ff4adc27a07444c18 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Sun, 8 Feb 2015 10:59:36 +0100 Subject: [PATCH 037/804] Add git-authors --- Commands.md | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/Commands.md b/Commands.md index 452d87970..63f40395b 100644 --- a/Commands.md +++ b/Commands.md @@ -3,6 +3,7 @@ - [`git squash`](#git-squash) - [`git summary`](#git-summary) - [`git effort`](#git-effort) + - [`git authors`](#git-authors) - [`git changelog`](#git-changelog) - [`git commits-since`](#git-commits-since) - [`git count`](#git-count) @@ -497,6 +498,40 @@ $ git squash HEAD~3 $ git squash HEAD~3 "Work on a feature" ``` +## git authors + +Populates the file matching `authors|contributors -i` with the authors of commits, according to the number of commits per author. + +Opens the file in `$EDITOR` when set. + +See the ["MAPPING AUTHORS" section](http://git-scm.com/docs/git-shortlog#_mapping_authors) of **git-shortlog**(1) to coalesce together commits by the same person. + +Updating AUTHORS file: + +```bash +$ git authors && cat AUTHORS + +TJ Holowaychuk +Tj Holowaychuk +hemanth.hm +Jonhnny Weslley +nickl- +Leila Muhtasib +``` + +Listing authors: + +```bash +$ git authors --list + +TJ Holowaychuk +Tj Holowaychuk +hemanth.hm +Jonhnny Weslley +nickl- +Leila Muhtasib +``` + ## git changelog Populate a file whose name matches `change|history -i_` with commits @@ -664,4 +699,4 @@ $ pwd .../very-deep-from-root-directory $ cd `git root` $ git add . && git commit -``` +``` \ No newline at end of file From e7b371b355ed9c1c3e2b852a7a5a955564933ea6 Mon Sep 17 00:00:00 2001 From: Ivan Malopinsky Date: Mon, 9 Feb 2015 21:09:11 -0500 Subject: [PATCH 038/804] git-delta --- bin/git-delta | 15 ++++++ man/git-delta.1 | 48 +++++++++++++++++++ man/git-delta.html | 117 +++++++++++++++++++++++++++++++++++++++++++++ man/git-delta.md | 32 +++++++++++++ 4 files changed, 212 insertions(+) create mode 100755 bin/git-delta create mode 100644 man/git-delta.1 create mode 100644 man/git-delta.html create mode 100644 man/git-delta.md diff --git a/bin/git-delta b/bin/git-delta new file mode 100755 index 000000000..5bcb74338 --- /dev/null +++ b/bin/git-delta @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +branch=master +filter=ACM + +if test $# -eq 1; then + branch=$1 +else + if test $# -eq 2; then + branch=$1 + filter=$2 + fi +fi + +git diff --name-only --diff-filter=$filter $branch \ No newline at end of file diff --git a/man/git-delta.1 b/man/git-delta.1 new file mode 100644 index 000000000..cbd231455 --- /dev/null +++ b/man/git-delta.1 @@ -0,0 +1,48 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-DELTA" "1" "February 2015" "" "" +. +.SH "NAME" +\fBgit\-delta\fR \- Lists changed files +. +.SH "SYNOPSIS" +\fBgit\-delta\fR [] [] +. +.SH "DESCRIPTION" +Lists all files that differ from a branch\. By default, lists files that have been added, copied, or modified as compared to the \fBmaster\fR branch\. +. +.SH "EXAMPLES" +Lists all modified and renamed files vs\. \fBmaster\fR: +. +.IP "" 4 +. +.nf + +$ git delta master MR +. +.fi +. +.IP "" 0 +. +.P +Lists all deleted files vs\. \fBexample\fR: +. +.IP "" 4 +. +.nf + +$ git delta example D +. +.fi +. +.IP "" 0 +. +.SH "AUTHOR" +Written by Ivan Malopinsky <\fIhello@imsky\.co\fR> +. +.SH "REPORTING BUGS" +<\fIhttps://github\.com/tj/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttps://github\.com/tj/git\-extras\fR> diff --git a/man/git-delta.html b/man/git-delta.html new file mode 100644 index 000000000..d7abbc9f2 --- /dev/null +++ b/man/git-delta.html @@ -0,0 +1,117 @@ + + + + + + git-delta(1) - Lists changed files + + + + +
+ + + +
    +
  1. git-delta(1)
  2. +
  3. +
  4. git-delta(1)
  5. +
+ +

NAME

+

+ git-delta - Lists changed files +

+ +

SYNOPSIS

+ +

git-delta [<branch>] [<filter>]

+ +

DESCRIPTION

+ +

Lists all files that differ from a branch. By default, lists files that have been added, copied, or modified as compared to the master branch.

+ +

EXAMPLES

+ +

Lists all modified and renamed files vs. master:

+ +
$ git delta master MR
+
+ +

Lists all deleted files vs. example:

+ +
$ git delta example D
+
+ +

AUTHOR

+ +

Written by Ivan Malopinsky <hello@imsky.co>

+ +

REPORTING BUGS

+ +

<https://github.com/tj/git-extras/issues>

+ +

SEE ALSO

+ +

<https://github.com/tj/git-extras>

+ + +
    +
  1. +
  2. February 2015
  3. +
  4. git-delta(1)
  5. +
+ +
+ + diff --git a/man/git-delta.md b/man/git-delta.md new file mode 100644 index 000000000..3315c80c2 --- /dev/null +++ b/man/git-delta.md @@ -0,0 +1,32 @@ +git-delta(1) -- Lists changed files +=================================== + +## SYNOPSIS + +`git-delta` [<branch>] [<filter>] + +## DESCRIPTION + +Lists all files that differ from a branch. By default, lists files that have been added, copied, or modified as compared to the `master` branch. + +## EXAMPLES + + Lists all modified and renamed files vs. `master`: + + $ git delta master MR + + Lists all deleted files vs. `example`: + + $ git delta example D + +## AUTHOR + +Written by Ivan Malopinsky <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> From 30d2f07360b7262b1b6dd02070078e6ce0fb6e83 Mon Sep 17 00:00:00 2001 From: Ivan Malopinsky Date: Mon, 9 Feb 2015 23:54:54 -0500 Subject: [PATCH 039/804] git delta usage --- Commands.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Commands.md b/Commands.md index 63f40395b..81baaa880 100644 --- a/Commands.md +++ b/Commands.md @@ -699,4 +699,22 @@ $ pwd .../very-deep-from-root-directory $ cd `git root` $ git add . && git commit +``` + +## git delta + +Lists files that differ from another branch. + +```bash +$ touch README.md +$ git setup +$ git checkout -b hello +$ echo hello >> README.md +$ git delta +README.md +$ touch Makefile +$ git add Makefile +$ git delta +Makefile +README.md ``` \ No newline at end of file From fc89e17a3c7a794dcece6c0eac798e691f7a21e5 Mon Sep 17 00:00:00 2001 From: Ivan Malopinsky Date: Tue, 10 Feb 2015 00:03:09 -0500 Subject: [PATCH 040/804] link to git delta --- Commands.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Commands.md b/Commands.md index 81baaa880..817fbf771 100644 --- a/Commands.md +++ b/Commands.md @@ -36,6 +36,7 @@ - [`git reset-file`](#git-reset-file) - [`git pr`](#git-pr) - [`git root`](#git-root) + - [`git delta`](#git-delta) ## git extras From b1a790b8513b142a36873087b868d0206f584ead Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Tue, 10 Feb 2015 16:00:25 -0800 Subject: [PATCH 041/804] Added in option to concat extra feature names This takes any extra arguments supplied to `$git feature` and sets them as the new feature name. For instances, instead of throwing an error if `$git feature new thing` is called, it will create branch `feature/new-thing`. --- bin/git-feature | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/git-feature b/bin/git-feature index 12dd91371..9d105a1ec 100755 --- a/bin/git-feature +++ b/bin/git-feature @@ -1,5 +1,14 @@ #!/usr/bin/env bash +concatargs(){ + delim='-' + str= + for i in "$@"; do + str="$str$delim$i" + done + branch=feature/${str:1} +} + if test "$1" = "finish"; then test -z $2 && echo "feature required." 1>&2 && exit 1 branch=feature/$2 @@ -7,9 +16,10 @@ if test "$1" = "finish"; then else test -z $1 && echo "feature required." 1>&2 && exit 1 if test -n "$2"; then - echo "too many arguments; if not finishing a feature, only of new feature is expected" && exit 1 + concatargs ${@:2} + else + branch=feature/$1 fi - branch=feature/$1 git checkout -b $branch &> /dev/null test -n $? && git checkout $branch &> /dev/null fi From a58ee0a4e93d7e23be4ab50a324ce5c3a96ae862 Mon Sep 17 00:00:00 2001 From: wooorm Date: Wed, 11 Feb 2015 08:53:12 +0100 Subject: [PATCH 042/804] Fix missing closing curly brance in `bash_completion.sh` - Introduced in b0a6d04f9ff303a9864070eda45c7309e3789ad4; - Comments: https://github.com/tj/git-extras/commit/ b0a6d04f9ff303a9864070eda45c7309e3789ad4#commitcomment-9687275. --- etc/bash_completion.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index 8280155be..d994a42bc 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -10,6 +10,7 @@ _git_changelog(){ _git_chore(){ __git_extras_workflow "chore" +} _git_authors(){ __gitcomp "-l --list" From 48eb195ee0426fe398e3082fed90500d370e5a5c Mon Sep 17 00:00:00 2001 From: Riceball LEE Date: Thu, 12 Feb 2015 17:55:31 +0800 Subject: [PATCH 043/804] + custom commit message options supports --- bin/git-release | 8 ++++++-- man/git-release.md | 12 ++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bin/git-release b/bin/git-release index a40e34879..e6869f9f8 100755 --- a/bin/git-release +++ b/bin/git-release @@ -29,13 +29,17 @@ if test $# -gt 0; then case "$1" in -c) git-changelog -t "$version" ;; -r) remote=$2; shift ;; + -m) msg=$2; shift ;; --) shift; break;; *) usage ;; esac shift done - git commit -a -m "Release $version" - git tag $version -a -m "Release $version" \ + if [ -z "$msg" ]; then + msg="Release ${version}" + fi + git commit -a -m "$msg" + git tag $version -a -m "$msg" \ && git push $remote \ && git push $remote --tags \ && hook post-release \ diff --git a/man/git-release.md b/man/git-release.md index 61018d0ab..5dd21abb1 100644 --- a/man/git-release.md +++ b/man/git-release.md @@ -3,11 +3,11 @@ git-release(1) -- Commit, tag and push changes to the repository ## SYNOPSIS -`git-release` <tagname> [-r <remote>] [-c] +`git-release` <tagname> [-r <remote>] [-m <commit info%gt;] [-c] ## DESCRIPTION - Commits changes with message "Release <tagname>", tags with the given <tagname> and pushes the branch / tags. + Commits changes with message "Release <tagname>" or custom commit infomation, tags with the given <tagname> and pushes the branch / tags. Optionally it generates a changelog (see git-changelog) and a remote can be defined. The order of first -c or -r does not matter. ## OPTIONS @@ -20,6 +20,10 @@ git-release(1) -- Commit, tag and push changes to the repository The "remote" repository that is destination of a push operation: it is passed to git push. + -m <commit info> + + use the custom commit infomation instead of the default message "Release <tagname>" . + -c Generates or populates the changelog with all commit message since the last tag. For more info see git-changelog.. @@ -30,6 +34,10 @@ git-release(1) -- Commit, tag and push changes to the repository $ git release 0.1.0 + * Release commit with the given <tagname> and custom commit message. + + $ git release 0.1.0 -m "+ powerful feature added." + * Release commit with the given <tagname> and push to specific remote. $ git release 0.1.0 -r github From a86d850688678076a04148fe29ed0ea37ae9da43 Mon Sep 17 00:00:00 2001 From: Damian Krzeminski Date: Fri, 13 Feb 2015 17:51:22 -0500 Subject: [PATCH 044/804] use standard git editor in git-authors & git-changelog The editor used will be chosen from the GIT_EDITOR environment variable, the core.editor configuration variable, the VISUAL environment variable, or the EDITOR environment variable (in that order). That ensures that `git-changelog` and `git-authors` will use the same editor as `git-commit`, `git-merge` etc. --- bin/git-authors | 1 + bin/git-changelog | 1 + 2 files changed, 2 insertions(+) diff --git a/bin/git-authors b/bin/git-authors index 194a64ba0..0996e3b27 100755 --- a/bin/git-authors +++ b/bin/git-authors @@ -2,6 +2,7 @@ LIST=false FILE="" +EDITOR=$(git var GIT_EDITOR) if test "$1" = "-l" || test "$1" = "--list"; then LIST=true diff --git a/bin/git-changelog b/bin/git-changelog index 096d73286..7c0cdd9bb 100755 --- a/bin/git-changelog +++ b/bin/git-changelog @@ -4,6 +4,7 @@ FILE="" LIST=false TAG="n.n.n" GIT_LOG_OPTS="" +EDITOR=$(git var GIT_EDITOR) while [ "$1" != "" ]; do case $1 in From fabb2c55418ba2deb54a045d2f143ce1a402ecf1 Mon Sep 17 00:00:00 2001 From: Damian Krzeminski Date: Sun, 15 Feb 2015 18:57:07 -0500 Subject: [PATCH 045/804] changelog: add git-config support for format and log options (1) make format configurable you can change the default changelog format by configuring changelog.format git variable for example: git config changelog.format '- %s (%ae)' gives you something like that: - Merge pull request #298 from timfeirg/master (hemanth.hm@gmail.com) - remove stuff from readme & form a list (kkcocogogo@gmail.com) see git-log man for more examples (2) make log options configurable set `changelog.opts` to influence the way changelogs are generated git config changelog.opts --no-merges or: git config changelog.opts --first-parent fixes #285 also: - delay calculating HEAD until needed - remove extra line before header --- bin/git-changelog | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/bin/git-changelog b/bin/git-changelog index 7c0cdd9bb..452157a03 100755 --- a/bin/git-changelog +++ b/bin/git-changelog @@ -3,7 +3,9 @@ FILE="" LIST=false TAG="n.n.n" -GIT_LOG_OPTS="" +GIT_LOG_OPTS=$(git config changelog.opts) +GIT_LOG_FORMAT=$(git config changelog.format) +test -z "$GIT_LOG_FORMAT" && GIT_LOG_FORMAT=' * %s' EDITOR=$(git var GIT_EDITOR) while [ "$1" != "" ]; do @@ -25,22 +27,22 @@ while [ "$1" != "" ]; do shift done -DATE=`date +'%Y-%m-%d'` -HEAD="\n$TAG / $DATE\n" -for i in $(seq 5 ${#HEAD}); do HEAD="$HEAD="; done -HEAD="$HEAD\n\n" - if $LIST; then lasttag=$(git rev-list --tags --max-count=1 2>/dev/null) version=$(git describe --tags --abbrev=0 $lasttag 2>/dev/null) if test -z "$version"; then - git log $GIT_LOG_OPTS --pretty="format: * %s" + git log $GIT_LOG_OPTS --pretty=format:"${GIT_LOG_FORMAT}" else - git log $GIT_LOG_OPTS --pretty="format: * %s" $version.. + git log $GIT_LOG_OPTS --pretty=format:"${GIT_LOG_FORMAT}" $version.. fi | sed 's/^ \* \*/ */g' exit fi +DATE=`date +'%Y-%m-%d'` +HEAD="\n$TAG / $DATE\n" +for i in $(seq 5 ${#HEAD}); do HEAD="$HEAD="; done +HEAD="$HEAD\n\n" + CHANGELOG=$FILE if test "$CHANGELOG" = ""; then CHANGELOG=`ls | egrep 'change|history' -i|head -n1` @@ -51,7 +53,7 @@ fi tmp=`mktemp -t $(basename $0).XXX` printf "$HEAD" > $tmp git-changelog $GIT_LOG_OPTS --list >> $tmp -printf '\n\n' >> $tmp +printf '\n' >> $tmp if [ -f $CHANGELOG ]; then cat $CHANGELOG >> $tmp; fi mv -f $tmp $CHANGELOG test -n "$EDITOR" && $EDITOR $CHANGELOG From 2a9ce31d25cb472c58ffbefdd857cadf1c94be0a Mon Sep 17 00:00:00 2001 From: chernjie Date: Mon, 16 Feb 2015 12:02:03 +0800 Subject: [PATCH 046/804] git scp #300 --- Commands.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Commands.md b/Commands.md index 817fbf771..f470ea27a 100644 --- a/Commands.md +++ b/Commands.md @@ -23,6 +23,7 @@ - [`git repl`](#git-repl) - [`git undo`](#git-undo) - [`git gh-pages`](#git-gh-pages) + - [`git scp`](#git-scp) - [`git setup`](#git-setup) - [`git touch`](#git-touch) - [`git obliterate`](#git-obliterate) @@ -593,6 +594,41 @@ git undo 3 Set up a git repository (if one doesn't exist), add all files, and make an initial commit. `dir` defaults to the current working directory. +## git scp + +A convenient way to copy files from the current working tree to the working directory of a remote repository. If a `...` is provided, only files that has changed within the commit range will be copied. + +Internally this script uses `rsync` and not `scp` as the name suggests. + +`git-rscp` - The reverse of `git-scp`. Copies specific files from the working directory of a remote repository to the current working directory. + +### Examples + + Copy unstaged files to remote. Useful when you want to make quick test without making any commits + + $ git scp staging + + Copy staged and unstaged files to remote + + $ git scp staging HEAD + + Copy files that has been changed in the last commit, plus any staged or unstaged files to remote + + $ git scp staging HEAD~1 + + Copy files that has been changed between now and a tag + + $ git scp staging v1.2.3 + + Copy specific files + + $ git scp staging index.html .gitignore .htaccess + + Copy specific directory + + $ git scp staging js/vendor/ + + ## git touch Call `touch` on the given file, and add it to the current index. One-step creation of new files. From bfeb897a6dfda09a177f3013bbd3ba191b3ec5e7 Mon Sep 17 00:00:00 2001 From: jykntr Date: Wed, 18 Feb 2015 17:09:39 -0700 Subject: [PATCH 047/804] git-summary correctly displays project name git-summary correctly displays project name when not executed in the top level directory of a repository. Fixes tj/git-extras#302. Uses the git-sh-setup script to find top level directory and then uses that directory name for the project name. --- bin/git-summary | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/git-summary b/bin/git-summary index 3017edc7f..c1bcdce9f 100755 --- a/bin/git-summary +++ b/bin/git-summary @@ -1,5 +1,9 @@ #!/usr/bin/env bash +SUBDIRECTORY_OK=Yes +source "$(git --exec-path)/git-sh-setup" +cd_to_toplevel + commit="" test $# -ne 0 && commit=$@ project=${PWD##*/} From 6df96739368c709c4633eae95a66e2c07406496a Mon Sep 17 00:00:00 2001 From: Jianjin Fan Date: Fri, 20 Feb 2015 12:25:25 +0800 Subject: [PATCH 048/804] Allow empty initial commit when setup repo. When hit `git setup` in an empty directory, it doesn't create a commit. But often we need an empty initial commit for future rebasing and reseting, etc. Fixes #318. --- bin/git-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/git-setup b/bin/git-setup index 00a323e49..6fdf675ea 100755 --- a/bin/git-setup +++ b/bin/git-setup @@ -13,4 +13,4 @@ mkdir -p "$dir" \ && gitdirexists \ && git init \ && git add . \ - && git commit -m 'Initial commit' + && git commit --allow-empty -m 'Initial commit' From c1b0067a97b0f64b4b17e8be3abfba79ac9ec7d3 Mon Sep 17 00:00:00 2001 From: Ciro Nunes Date: Tue, 3 Mar 2015 09:01:19 -0300 Subject: [PATCH 049/804] fix gh-pages to stash and don't delete files Closes #137 --- bin/git-gh-pages | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/bin/git-gh-pages b/bin/git-gh-pages index b7f3a8ca0..f51c813b4 100755 --- a/bin/git-gh-pages +++ b/bin/git-gh-pages @@ -1,12 +1,21 @@ #!/usr/bin/env bash echo 'setting up gh-pages' -git symbolic-ref HEAD refs/heads/gh-pages \ - && rm .git/index \ - && git clean -fdx \ - && echo 'My Page' > index.html \ - && git add . \ - && git commit -a -m 'Initial commit' \ - && git push -u origin gh-pages \ - && git fetch origin \ - && echo 'complete' +echo '-------------------' + +echo 'Tell me your github account username: ' +read username + +echo 'Now, tell me your repository name: ' +read repository + +git stash \ +&& git checkout -b 'gh-pages' \ +&& echo 'My Page' > index.html \ +&& git add . \ +&& git commit -a -m 'Initial commit' \ +&& git remote add origin https://github.com/"$username"/"$repository".git \ +&& git push -u origin gh-pages \ +&& echo 'Complete' \ +&& echo '-------------------' \ +&& echo 'You can find your last changes in the stash!' From 28df09b10323817bb7ffecfc9c819841a73b2b5e Mon Sep 17 00:00:00 2001 From: Andrew Starr-Bochicchio Date: Mon, 9 Mar 2015 22:14:05 -0400 Subject: [PATCH 050/804] git-fresh-branch: Check for changes and prompt for input before nuking. (Issue: #142) --- bin/git-fresh-branch | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/bin/git-fresh-branch b/bin/git-fresh-branch index 5af1245b7..42b567ade 100755 --- a/bin/git-fresh-branch +++ b/bin/git-fresh-branch @@ -4,6 +4,21 @@ branch=$1 test -z $branch && echo "branch required." 1>&2 && exit 1 -git symbolic-ref HEAD refs/heads/$branch -rm .git/index -git clean -fdx +changes=`git status --porcelain` + +clean() +{ + git symbolic-ref HEAD refs/heads/$branch + rm .git/index + git clean -fdx +} + +if [ ! -z "$changes" ]; then + read -p "All untracked changes will be lost. Continue [y/N]? " res + case $res in + [Yy]* ) clean; break;; + * ) exit 0;; + esac +fi + +clean From d94663312f7c508862d5df4970bf29a1a5dfd316 Mon Sep 17 00:00:00 2001 From: spacewander Date: Tue, 10 Mar 2015 18:14:56 +0800 Subject: [PATCH 051/804] add merge-into to merge two branches quickly --- bin/git-merge-into | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 bin/git-merge-into diff --git a/bin/git-merge-into b/bin/git-merge-into new file mode 100755 index 000000000..4075863d7 --- /dev/null +++ b/bin/git-merge-into @@ -0,0 +1,34 @@ +#!/bin/bash + +current_branch() { + git rev-parse --abbrev-ref HEAD +} + +usage() { + echo "Usage: git merge-into [src] dest [--ff]" +} + +cur_branch=$(current_branch) +if [ "${!#}" == '--ff' ]; then + case $# in + 2 ) # dest --ff + git push "$(git rev-parse --show-toplevel)" "$cur_branch":"$1";; + 3 ) + git push "$(git rev-parse --show-toplevel)" "$1":"$2";; + * ) + usage + esac +else + case $# in + 1 ) + git checkout "$1" + git merge "$cur_branch" "$1" && git checkout "$cur_branch" + ;; + 2 ) + git checkout "$2" + git merge "$1" "$2" && git checkout "$cur_branch" + ;; + * ) + usage + esac +fi From 46525fbfe82de4f7eb19d24eca8009ba11dedcc1 Mon Sep 17 00:00:00 2001 From: spacewander Date: Tue, 10 Mar 2015 23:50:09 +0800 Subject: [PATCH 052/804] add docs for git-merge-into --- man/git-merge-into.1 | 76 +++++++++++++++++++++ man/git-merge-into.html | 143 ++++++++++++++++++++++++++++++++++++++++ man/git-merge-into.md | 57 ++++++++++++++++ 3 files changed, 276 insertions(+) create mode 100644 man/git-merge-into.1 create mode 100644 man/git-merge-into.html create mode 100644 man/git-merge-into.md diff --git a/man/git-merge-into.1 b/man/git-merge-into.1 new file mode 100644 index 000000000..9cda4ee0c --- /dev/null +++ b/man/git-merge-into.1 @@ -0,0 +1,76 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-MERGE\-INTO" "1" "March 2015" "" "Git Extras" +. +.SH "NAME" +\fBgit\-merge\-into\fR \- Merge one branch into another +. +.SH "SYNOPSIS" +\fBgit merge\-into\fR [src] [\-\-ff] +. +.SH "DESCRIPTION" +Merge one branch into another, and keep yourself on current branch\. If src branch not given, it will merge current one to dest\. +. +.SH "OPTIONS" + +. +.P +The name of the branch will be merged into\. If this not given, use current branch as default\. +. +.P + +. +.P +The name of the branch to merge into\. +. +.P +\-\-ff +. +.P +Try to use \fBgit push\fR instead of \fBgit merge\fR\. Only work on fast\-forward mode\. +. +.SH "EXAMPLES" +Assume the following history exists and the current branch is src: +. +.IP "" 4 +. +.nf + + A\-\-\-B\-\-\-C src(current) + / + D\-\-\-E\-\-\-F\-\-\-G dest +. +.fi +. +.IP "" 0 +. +.P +After running \fBgit merge\-into dest\fR, it will look like this: +. +.IP "" 4 +. +.nf + + A\-\-\-B\-\-\-C src(current) + / \e + D\-\-\-E\-\-\-F\-\-\-G\-\-\-H dest +. +.fi +. +.IP "" 0 +. +.P +The \fBH\fR commit will record the merge result, just like what \fBgit merge\fR does\. And \fBsrc\fR is still the current branch\. +. +.P +The default implementation of \fBmerge\-into\fR use \fBgit checkout\fR and \fBgit merge\fR, which may cause temporary change in the working tree\. If you make sure your branch can be merged fast\-forward, add \fB\-\-ff\fR to avoid files change\. +. +.SH "AUTHOR" +Written by spacewander <\fIspacewanderlzx@gmail\.com\fR> +. +.SH "REPORTING BUGS" +<\fIhttps://github\.com/tj/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttps://github\.com/tj/git\-extras\fR> diff --git a/man/git-merge-into.html b/man/git-merge-into.html new file mode 100644 index 000000000..fa3d36a46 --- /dev/null +++ b/man/git-merge-into.html @@ -0,0 +1,143 @@ + + + + + + git-merge-into(1) - Merge one branch into another + + + + +
+ + + +
    +
  1. git-merge-into(1)
  2. +
  3. Git Extras
  4. +
  5. git-merge-into(1)
  6. +
+ +

NAME

+

+ git-merge-into - Merge one branch into another +

+ +

SYNOPSIS

+ +

git merge-into [src] <dest> [--ff]

+ +

DESCRIPTION

+ +

Merge one branch into another, and keep yourself on current branch. If src branch not given, it will merge current one to dest.

+ +

OPTIONS

+ +

<src>

+ +

The name of the branch will be merged into. If this not given, use current branch as default.

+ +

<dest>

+ +

The name of the branch to merge into.

+ +

--ff

+ +

Try to use git push instead of git merge. Only work on fast-forward mode.

+ +

EXAMPLES

+ +

Assume the following history exists and the current branch is src:

+ +
                 A---B---C src(current)
+                /
+           D---E---F---G dest
+
+ +

After running git merge-into dest, it will look like this:

+ +
                A---B---C src(current)
+                /         \
+           D---E---F---G---H dest
+
+ +

The H commit will record the merge result, just like what git merge does. +And src is still the current branch.

+ +

The default implementation of merge-into use git checkout and git merge, +which may cause temporary change in the working tree. If you make sure your +branch can be merged fast-forward, add --ff to avoid files change.

+ +

AUTHOR

+ +

Written by spacewander <spacewanderlzx@gmail.com>

+ +

REPORTING BUGS

+ +

<https://github.com/tj/git-extras/issues>

+ +

SEE ALSO

+ +

<https://github.com/tj/git-extras>

+ + +
    +
  1. +
  2. March 2015
  3. +
  4. git-merge-into(1)
  5. +
+ +
+ + diff --git a/man/git-merge-into.md b/man/git-merge-into.md new file mode 100644 index 000000000..8d200ca73 --- /dev/null +++ b/man/git-merge-into.md @@ -0,0 +1,57 @@ +git-merge-into(1) -- Merge one branch into another +================================= + +## SYNOPSIS + +`git merge-into` [src] <dest> [--ff] + +## DESCRIPTION + +Merge one branch into another, and keep yourself on current branch. If src branch not given, it will merge current one to dest. + +## OPTIONS + + <src> + + The name of the branch will be merged into. If this not given, use current branch as default. + + <dest> + + The name of the branch to merge into. + + --ff + + Try to use `git push` instead of `git merge`. Only work on fast-forward mode. + +## EXAMPLES + +Assume the following history exists and the current branch is src: + + A---B---C src(current) + / + D---E---F---G dest + +After running `git merge-into dest`, it will look like this: + + A---B---C src(current) + / \ + D---E---F---G---H dest + +The `H` commit will record the merge result, just like what `git merge` does. +And `src` is still the current branch. + +The default implementation of `merge-into` use `git checkout` and `git merge`, +which may cause temporary change in the working tree. If you make sure your +branch can be merged fast-forward, add `--ff` to avoid files change. + +## AUTHOR + +Written by spacewander <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> From b2c937e03a8f6b20f723ff824d6efc5c1e495cbc Mon Sep 17 00:00:00 2001 From: spacewander Date: Wed, 11 Mar 2015 14:47:08 +0800 Subject: [PATCH 053/804] add wiki for git-merge-into --- Commands.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Commands.md b/Commands.md index f470ea27a..0ad73057a 100644 --- a/Commands.md +++ b/Commands.md @@ -13,6 +13,7 @@ - [`git delete-tag`](#git-delete-tag) - [`git delete-merged-branches`](#git-delete-merged-branches) - [`git fresh-branch`](#git-fresh-branch) + - [`git merge-into`](#git-merge-into) - [`git graft`](#git-graft) - [`git alias`](#git-alias) - [`git ignore`](#git-ignore) @@ -475,6 +476,14 @@ Create empty local branch `name`: $ git fresh-branch docs ``` +## git merge-into + +Merge `src` branch into `dest`, and keep yourself on current branch. If `src` branch not given, it will merge current one to `dest`: + +```bash +$ git merge-into [src] dest +``` + ## git graft Merge commits from `src-branch` into `dest-branch`. (`dest-branch` defaults to `master`.) From bf89063212599d02c75f9c1361c093bd8adf443b Mon Sep 17 00:00:00 2001 From: CJ Date: Wed, 11 Mar 2015 14:51:04 +0800 Subject: [PATCH 054/804] Support ~ in show git-ignore --- bin/git-ignore | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/git-ignore b/bin/git-ignore index 6182093a0..aa90597d8 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -1,8 +1,9 @@ #!/usr/bin/env bash function show_contents { - if [ -f "$2" ]; then - echo "$1 gitignore: $2" && cat "$2" + local file="${2/#~/$HOME}" + if [ -f "$file" ]; then + echo "$1 gitignore: $2" && cat "$file" else echo "There is no $1 .gitignore yet" fi From 522213a28f10d95bf809dc073d90a5c66bb34b33 Mon Sep 17 00:00:00 2001 From: CJ Date: Wed, 11 Mar 2015 14:59:42 +0800 Subject: [PATCH 055/804] Support ~ in add_patterns for git-ignore --- bin/git-ignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/git-ignore b/bin/git-ignore index aa90597d8..09382973d 100755 --- a/bin/git-ignore +++ b/bin/git-ignore @@ -29,9 +29,10 @@ function add_local { function add_patterns { echo "Adding pattern(s) to: $1" + local file="${1/#~/$HOME}" for pattern in "${@:2}"; do echo "... adding '$pattern'" - (test -f "$1" && test "$pattern" && grep -q "$pattern" "$1") || echo "$pattern" >> "$1" + (test -f "$file" && test "$pattern" && grep -q "$pattern" "$file") || echo "$pattern" >> "$file" done } From 49e8cf17a4947bc1fbdc911c798b83762632a17c Mon Sep 17 00:00:00 2001 From: Mark Eissler Date: Mon, 9 Mar 2015 14:54:42 -0700 Subject: [PATCH 056/804] Complete rewrite to support commit ranges for pretty and list output. --- AUTHORS | 1 + bin/git-changelog | 356 ++++++++++++++++++++++++++++++++++------- man/git-changelog.1 | 121 ++++++++++---- man/git-changelog.html | 95 +++++++---- man/git-changelog.md | 84 +++++++--- 5 files changed, 524 insertions(+), 133 deletions(-) diff --git a/AUTHORS b/AUTHORS index eebf30732..bf21165b0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -13,6 +13,7 @@ Maintainer Patches and Suggestions ``````````````````````` +- Mark Eissler - Kenneth Reitz - Aggelos Orfanakos - Jonathan "Duke" Leto diff --git a/bin/git-changelog b/bin/git-changelog index e6bc4fbdd..3761998cd 100755 --- a/bin/git-changelog +++ b/bin/git-changelog @@ -1,59 +1,307 @@ #!/usr/bin/env bash -FILE="" -LIST=false -TAG="n.n.n" -GIT_LOG_OPTS=$(git config changelog.opts) -GIT_LOG_FORMAT=$(git config changelog.format) -test -z "$GIT_LOG_FORMAT" && GIT_LOG_FORMAT=' * %s' -EDITOR=$(git var GIT_EDITOR) - -while [ "$1" != "" ]; do - case $1 in - -l | --list ) - LIST=true - ;; - -t | --tag ) - TAG=$2 - shift - ;; - --no-merges ) - GIT_LOG_OPTS='--no-merges' - ;; - * ) - FILE=$1 - ;; - esac - shift -done - -if $LIST; then - lasttag=$(git rev-list --tags --max-count=1 2>/dev/null) - version=$(git describe --tags --abbrev=0 $lasttag 2>/dev/null) - if test -z "$version"; then +DEF_TAG_RECENT="n.n.n" +GIT_LOG_OPTS="$(git config changelog.opts)" +GIT_LOG_FORMAT="$(git config changelog.format)" +[[ -z "$GIT_LOG_FORMAT" ]] && GIT_LOG_FORMAT=' * %s' +GIT_EDITOR="$(git var GIT_EDITOR)" +PROGNAME="git-changelog" + +_usage() { +cat << EOF +usage: $PROGNAME options [file] +usage: $PROGNAME -h|help|? + +Generate a Changelog from git(1) tags (annotated or lightweight) and commit +messages. Existing Changelog files with filenames that begin with 'Change' or +'History' will be identified automatically and their content will be appended +to the new output generated (unless the -p|--prune-old option is used). If no +tags exist, then all commits are output; if tags exist, then only the most- +recent commits are output up to the last identified tag. + +OPTIONS: + -a, --all Retrieve all commits (ignores --start-tag, --final-tag) + -l, --list Display commits as a list, with no titles + -t, --tag Tag label to use for most-recent (untagged) commits + -f, --final-tag Newest tag to retrieve commits from in a range + -s, --start-tag Oldest tag to retrieve commits from in a range + -n, --no-merges Suppress commits from merged branches + -p, --prune-old Replace existing Changelog entirely with new content + -x, --stdout Write output to stdout instead of to a Changelog file + -h, --help, ? Show this message +EOF +} + +_error() { + [ $# -eq 0 ] && _usage && exit 0 + + echo + echo "ERROR: " "$@" + echo +} + + +_fetchCommitRange() { + local list_all="${1:-false}" + local start_tag="$2" + local final_tag="$3" + + if [[ "$list_all" == true ]]; then git log $GIT_LOG_OPTS --pretty=format:"${GIT_LOG_FORMAT}" - else - git log $GIT_LOG_OPTS --pretty=format:"${GIT_LOG_FORMAT}" $version.. + elif [[ -n "$final_tag" && "$start_tag" == "null" ]]; then + git log $GIT_LOG_OPTS --pretty=format:"${GIT_LOG_FORMAT}" "${final_tag}" + elif [[ -n "$final_tag" ]]; then + git log $GIT_LOG_OPTS --pretty=format:"${GIT_LOG_FORMAT}" "${start_tag}"'..'"${final_tag}" + elif [[ -n "$start_tag" ]]; then + git log $GIT_LOG_OPTS --pretty=format:"${GIT_LOG_FORMAT}" "${start_tag}"'..' fi | sed 's/^ \* \*/ */g' - exit -fi - -DATE=`date +'%Y-%m-%d'` -HEAD="\n$TAG / $DATE\n" -for i in $(seq 5 ${#HEAD}); do HEAD="$HEAD="; done -HEAD="$HEAD\n\n" - -CHANGELOG=$FILE -if test "$CHANGELOG" = ""; then - CHANGELOG=`ls | egrep 'change|history' -i|head -n1` - if test "$CHANGELOG" = ""; then - CHANGELOG='History.md'; +} + +_formatCommitPlain() { + local start_tag="$1" + local final_tag="$2" + + printf "%s" "$(_fetchCommitRange "false" "$start_tag" "$final_tag")" +} + +_formatCommitPretty() { + local title_tag="$1" + local title_date="$2" + local start_tag="$3" + local final_tag="$4" + local title="$title_tag / $title_date" + local title_underline="" + + local i + for i in $(seq ${#title}); do + title_underline+="=" + done + unset i + + printf '\n%s\n%s\n' "$title" "$title_underline" + printf "\n%s\n" "$(_fetchCommitRange "false" "$start_tag" "$final_tag")" +} + +commitList() { + # parameter list supports empty arguments! + local list_all="${1:-false}"; shift + local title_tag="$1"; shift + local start_tag="$1"; shift + local final_tag="$1"; shift + local list_style="${1:-false}" # enable/disable list format + local changelog="$FILE" + local title_date="$(date +'%Y-%m-%d')" + local -A tags_list=() + local tags_list_keys=() + local defaultIFS="$IFS" + local IFS="$defaultIFS" + + # fetch our tags + local _ref _date _tag _tab='%x09' + while IFS=$'\t' read _ref _date _tag; do + [[ -z "${_tag}" ]] && continue + # strip out any additional tags pointing to same commit, remove tag label + _tag="${_tag%%,*}"; _tag="${_tag#tag: }" + # add tag to assoc array; copy tag to tag_list_keys for ordered iteration + tags_list["${_tag}"]="${_ref}=>${_date}" + tags_list_keys+=( "${_tag}" ) + done <<< "$(git log --tags --simplify-by-decoration --date="short" --pretty="format:%h${_tab}%ad${_tab}%D")" + IFS="$defaultIFS" + unset _ref _date _tag _tab + + local _tags_list_keys_length="${#tags_list_keys[@]}" + local _final_tag_found=false + local _start_tag_found=false + local i + for (( i=0; i<"${_tags_list_keys_length}"; i++ )); do + local __curr_tag="${tags_list_keys[$i]}" + local __prev_tag="${tags_list_keys[$i+1]:-null}" + local __curr_date="${tags_list[${__curr_tag}]##*=>}" + + # output latest commits, up until the most-recent tag, these are all + # new commits made since the last tagged commit. + if [[ $i -eq 0 && ( -z "$final_tag" || "$final_tag" == "null" ) ]]; then + if [[ "$list_style" == true ]]; then + _formatCommitPlain "${__curr_tag}" >> "$tmpfile" + else + _formatCommitPretty "$title_tag" "$title_date" "${__curr_tag}" + fi + fi + + # both final_tag and start_tag are "null", user just wanted recent commits + [[ "$final_tag" == "null" && "$start_tag" == "null" ]] && break; + + # find the specified final tag, continue until found + if [[ -n "$final_tag" && "$final_tag" != "null" ]]; then + [[ "$final_tag" == "${__curr_tag}" ]] && _final_tag_found=true + [[ "$final_tag" != "${__curr_tag}" && "${_final_tag_found}" == false ]] && continue + fi + + # find the specified start tag, break when found + if [[ -n "$start_tag" ]]; then + [[ "$start_tag" == "${__curr_tag}" ]] && _start_tag_found=true + [[ "$start_tag" != "${__curr_tag}" && "${_start_tag_found}" == true ]] && break + fi + + # output commits made between prev_tag and curr_tag, these are all of the + # commits related to the tag of interest. + if [[ "$list_style" == true ]]; then + _formatCommitPlain "${__prev_tag}" "${__curr_tag}" + else + _formatCommitPretty "${__curr_tag}" "${__curr_date}" "${__prev_tag}" "${__curr_tag}" + fi + done + unset i + unset _start_tag_found + unset _final_tag_found + + return +} + +commitListPlain() { + local list_all="${1:-false}" + local start_tag="$2" + local final_tag="$3" + + commitList "$list_all" "" "$start_tag" "$final_tag" "true" +} + +commitListPretty() { + local list_all="${1:-false}" + local title_tag="$2" + local start_tag="$3" + local final_tag="$4" + local title_date="$(date +'%Y-%m-%d')" + + commitList "$list_all" "$title_tag" "$start_tag" "$final_tag" +} + +main() { + local start_tag="null" # empty string and "null" mean two different things! + local final_tag="null" + + local -A option=() + option["list_all"]=false + option["list_style"]=false + option["title_tag"]="$DEF_TAG_RECENT" + option["start_tag"]="" + option["final_tag"]="" + option["output_file"]="" + option["use_stdout"]=false + option["prune_old"]=false + + # + # We work chronologically backwards from NOW towards start_tag where NOW also + # includes the most-recent (un-tagged) commits. If no start_tag has been + # specified, we work back to the very first commit; if a final_tag has been + # specified, we begin at the final_tag and work backwards towards start_tag. + # + + # An existing ChangeLog/History file will be appended to the output unless the + # prune old (-p | --prune-old) option has been enabled. + + while [ "$1" != "" ]; do + case $1 in + -a | --all ) + option["list_all"]=true + ;; + -l | --list ) + option["list_style"]=true + ;; + -t | --tag ) + option["title_tag"]="$2" + shift + ;; + -f | --final-tag ) + option["final_tag"]="$2" + shift + ;; + -s | --start-tag ) + option["start_tag"]="$2" + shift + ;; + -n | --no-merges ) + GIT_LOG_OPTS='--no-merges' + ;; + -p | --prune-old ) + option["prune_old"]=true + ;; + -x | --stdout ) + option["use_stdout"]=true + ;; + -h | ? | help | --help ) + _usage + exit 1 + ;; + * ) + [[ "${1:0:1}" == '-' ]] && _error "Invalid option: $1" && _usage && exit 1 + option["output_file"]="$1" + ;; + esac + shift + done + + if [[ -n "${option["start_tag"]}" ]]; then + start_tag="$(git describe --tags --abbrev=0 "${option["start_tag"]}" 2>/dev/null)" + if [[ -z "$start_tag" ]]; then + _error "Specified start-tag does not exist!" + return 1 + fi + fi + + if [[ -n "${option["final_tag"]}" ]]; then + final_tag="$(git describe --tags --abbrev=0 "${option["final_tag"]}" 2>/dev/null)" + if [[ -z "$final_tag" ]]; then + _error "Specified final-tag does not exist!" + return 1 + fi + fi + + # + # generate changelog + # + local tmpfile="$(git_extra_mktemp)" + local changelog="${option["output_file"]}" + local title_tag="${option["title_tag"]}" + + if [[ "${option["list_style"]}" == true ]]; then + if [[ "${option["list_all"]}" == true ]]; then + commitListPlain "true" >> "$tmpfile" + else + commitListPlain "false" "$start_tag" "$final_tag" >> "$tmpfile" + fi + else + if [[ "${option["list_all"]}" == true ]]; then + commitListPretty "true" "$title_tag" >> "$tmpfile" + else + commitListPretty "false" "$title_tag" "$start_tag" "$final_tag" >> "$tmpfile" + fi + fi + + if [[ -z "$changelog" ]]; then + changelog="$(ls | egrep 'change|history' -i | head -n1)" + if [[ -z "$changelog" ]]; then + changelog="History.md"; + fi + fi + + # append existing changelog? + if [[ -f "$changelog" && "${option["prune_old"]}" == false ]]; then + cat "$changelog" >> "$tmpfile" fi -fi -tmp=$(git_extra_mktemp) -printf "$HEAD" > $tmp -git-changelog $GIT_LOG_OPTS --list >> $tmp -printf '\n' >> $tmp -if [ -f $CHANGELOG ]; then cat $CHANGELOG >> $tmp; fi -mv -f $tmp $CHANGELOG -test -n "$EDITOR" && $EDITOR $CHANGELOG + + # output file to stdout or move into place + if [[ "${option["use_stdout"]}" == true ]]; then + cat "$tmpfile" + rm -f "$tmpfile" + else + mv -f "$tmpfile" "$changelog" + [[ -n "$GIT_EDITOR" ]] && $GIT_EDITOR "$changelog" + fi + + return +} + +main "$@" + +exit 0 diff --git a/man/git-changelog.1 b/man/git-changelog.1 index 6c5988625..be278d81e 100644 --- a/man/git-changelog.1 +++ b/man/git-changelog.1 @@ -1,80 +1,135 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "GIT\-CHANGELOG" "1" "November 2014" "" "" +.TH "GIT\-CHANGELOG" "1" "March 2015" "" "Git Extras" . .SH "NAME" -\fBgit\-changelog\fR \- Generate the changelog report +\fBgit\-changelog\fR \- Generate a changelog report . .SH "SYNOPSIS" -\fBgit\-changelog\fR [\-l, \-\-list] +\fBgit\-changelog\fR [options] [] +. +.br +\fBgit\-changelog\fR {\-h | \-\-help | ?} . .SH "DESCRIPTION" -Populates the file named matching \fIchange|history \-i\fR with the commits since the previous tag or since the project began when no tags are present\. Opens the changelog in \fB$EDITOR\fR when set\. +Generates a changelog from git(1) tags (annotated or lightweight) and commit messages\. Existing changelog files with filenames that begin with \fIChange\fR or \fIHistory\fR will be identified automatically with a case insensitive match pattern and existing content will be appended to the new output generated\-\-this behavior can be disabled by specifying the prune option (\-p|\-\-prune\-old)\. The generated file will be opened in \fB$EDITOR\fR when set\. +. +.P +If no tags exist, then all commits are output; if tags exist, then only the most\-recent commits are output up to the last identified tag\. This behavior can be changed by specifing one or both of the range options (\-f|\-\-final\-tag and \-s|\-\-start\-tag)\. . .SH "OPTIONS" + +. +.P +The name of the output file\. By default the new file will be \fIHistory\.md\fR unless an existing changelog is detected in which case the existing file will be updated\. +. +.P +\-a, \-\-all +. +.P +Retrieve all commits\. Ignores \-s|\-\-start\-tag and \-f|\-\-final\-tag options (if set)\. +. +.P \-l, \-\-list . .P -Show commit logs from the current version\. +Show commits in list format (without titles, dates)\. +. +.P +\-t, \-\-tag +. +.P +Specify a tag label to use for most\-recent (untagged) commits\. +. +.P +\-f, \-\-final\-tag +. +.P +When specifying a range, the newest tag at which point commit retrieval will end\. Commits will be returned from the very first commit until the final tag unless a start tag is also specified\. +. +.P +\-s, \-\-start\-tag . .P -\-\-no\-merges +When specifying a range, the oldest tag to retrieve commits from\. Commits will be returned from the start tag to now unless a final tag is also specified\. +. +.P +\-n, \-\-no\-merges . .P Filters out merge commits (commits with more than 1 parent) from generated changelog\. . +.P +\-p, \-\-prune\-old +. +.P +Replace existing changelog entirely with newly generated content, thereby disabling the default behavior of appending the content of any detected changelog to the end of newly generated content\. +. +.P +\-x, \-\-stdout +. +.P +Write output to stdout instead of to a new changelog file\. +. +.P +\-h, \-\-help, ? +. +.P +Show a help message with basic usage information\. +. .SH "EXAMPLES" . -.IP "\(bu" 4 -Updating changelog file: +.TP +Updating existing file or creating a new \fIHistory\.md\fR file with pretty formatted output: . .IP $ git changelog . -.IP "\(bu" 4 +.TP Listing commits from the current version: . .IP $ git changelog \-\-list . -.IP "\(bu" 4 -Docs for git\-ignore\. Closes #3 +.TP +Listing a range of commits from 2\.1\.0 to now: . -.IP "\(bu" 4 -Merge branch \'ignore\' +.IP +$ git changelog \-\-list \-\-start\-tag 2\.1\.0 . -.IP "\(bu" 4 -Added git\-ignore +.TP +Listing a pretty formatted version of the same: . -.IP "\(bu" 4 -Fixed in docs +.IP +$ git changelog \-\-start\-tag 2\.1\.0 . -.IP "\(bu" 4 -Install docs +.TP +Listing a range of commits from initial commit to 2\.1\.0: . -.IP "\(bu" 4 -Merge branch \'release\' +.IP +$ git changelog \-\-list \-\-final\-tag 2\.1\.0 . -.IP "\(bu" 4 -Added git\-release +.TP +Listing a pretty formatted range of commits between 0\.5\.0 and 1\.0\.0: . -.IP "\(bu" 4 -Passing args to git shortlog +.IP +$ git changelog \-\-start\-tag 0\.5\.0 \-\-final\-tag 1\.0\.0 . -.IP "\(bu" 4 -Added \-\-all support to git\-count +.TP +Specifying a file for output: . -.IP "\(bu" 4 -Initial commit +.IP +$ git changelog ChangeLog\.md . -.IP "" 0 - +.TP +And if an existing Changelog exists, replace its contents entirely: . -.IP "" 0 +.IP +$ git changelog \-\-prune\-old . .SH "AUTHOR" -Written by Tj Holowaychuk <\fItj@vision\-media\.ca\fR> +Written by Mark Eissler <\fImark@mixtur\.com\fR> . .SH "REPORTING BUGS" <\fIhttps://github\.com/tj/git\-extras/issues\fR> diff --git a/man/git-changelog.html b/man/git-changelog.html index 60f9f5313..2c6d02950 100644 --- a/man/git-changelog.html +++ b/man/git-changelog.html @@ -3,7 +3,7 @@ - git-changelog(1) - Generate the changelog report + git-changelog(1) - Generate a changelog report + + + +
+ + + +
    +
  1. git-show-merged-branches(1)
  2. +
  3. +
  4. git-show-merged-branches(1)
  5. +
+ +

NAME

+

+ git-show-merged-branches - Show merged branches +

+ +

SYNOPSIS

+ +

git-show-merged-branches

+ +

DESCRIPTION

+ +

Shows all branches merged in to current HEAD.

+ +

EXAMPLES

+ +
$ git show-merged-branches
+
+ +

AUTHOR

+ +

Written by Paul Schreiber <paulschreiber@gmail.com>

+ +

REPORTING BUGS

+ +

<https://github.com/tj/git-extras/issues>

+ +

SEE ALSO

+ +

<https://github.com/tj/git-extras>

+ + +
    +
  1. +
  2. March 2015
  3. +
  4. git-show-merged-branches(1)
  5. +
+ +
+ + diff --git a/man/git-show-merged-branches.md b/man/git-show-merged-branches.md new file mode 100644 index 000000000..1e344a05c --- /dev/null +++ b/man/git-show-merged-branches.md @@ -0,0 +1,26 @@ +git-show-merged-branches(1) -- Show merged branches +=================================================== + +## SYNOPSIS + +`git-show-merged-branches` + +## DESCRIPTION + + Show all branches merged in to current HEAD. + +## EXAMPLES + + $ git show-merged-branches + +## AUTHOR + +Written by Paul Schreiber <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> diff --git a/man/git-show-unmerged-branches.1 b/man/git-show-unmerged-branches.1 new file mode 100644 index 000000000..7ed3d0ff9 --- /dev/null +++ b/man/git-show-unmerged-branches.1 @@ -0,0 +1,30 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-SHOW\-UNMERGED\-BRANCHES" "1" "March 2015" "" "" +. +.SH "NAME" +\fBgit\-show\-unmerged\-branches\fR \- Show unmerged branches +. +.SH "SYNOPSIS" +\fBgit\-show\-unmerged\-branches\fR +. +.SH "DESCRIPTION" +Shows all branches not merged in to current HEAD\. +. +.SH "EXAMPLES" +. +.nf + +$ git show\-unmerged\-branches +. +.fi +. +.SH "AUTHOR" +Written by Paul Schreiber <\fIpaulschreiber@gmail\.com\fR> +. +.SH "REPORTING BUGS" +<\fIhttps://github\.com/tj/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttps://github\.com/tj/git\-extras\fR> diff --git a/man/git-show-unmerged-branches.html b/man/git-show-unmerged-branches.html new file mode 100644 index 000000000..bb6e899e2 --- /dev/null +++ b/man/git-show-unmerged-branches.html @@ -0,0 +1,110 @@ + + + + + + git-shw-unmerged-branches(1) - Show unmerged branches + + + + +
+ + + +
    +
  1. git-show-unmerged-branches(1)
  2. +
  3. +
  4. git-show-unmerged-branches(1)
  5. +
+ +

NAME

+

+ git-show-unmerged-branches - Show unmerged branches +

+ +

SYNOPSIS

+ +

git-show-unmerged-branches

+ +

DESCRIPTION

+ +

Shows all branches not merged in to current HEAD.

+ +

EXAMPLES

+ +
$ git show-unmerged-branches
+
+ +

AUTHOR

+ +

Written by Paul Schreiber <paulschreiber@gmail.com>

+ +

REPORTING BUGS

+ +

<https://github.com/tj/git-extras/issues>

+ +

SEE ALSO

+ +

<https://github.com/tj/git-extras>

+ + +
    +
  1. +
  2. March 2015
  3. +
  4. git-show-unmerged-branches(1)
  5. +
+ +
+ + diff --git a/man/git-show-unmerged-branches.md b/man/git-show-unmerged-branches.md new file mode 100644 index 000000000..561215656 --- /dev/null +++ b/man/git-show-unmerged-branches.md @@ -0,0 +1,26 @@ +git-show-unmerged-branches(1) -- Show unmerged branches +======================================================= + +## SYNOPSIS + +`git-show-unmerged-branches` + +## DESCRIPTION + + Show all branches not merged in to current HEAD. + +## EXAMPLES + + $ git show-unmerged-branches + +## AUTHOR + +Written by Paul Schreiber <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> diff --git a/man/index.txt b/man/index.txt index 6250cd79b..beb9920d3 100644 --- a/man/index.txt +++ b/man/index.txt @@ -33,7 +33,9 @@ git-rename-tag(1) git-rename-tag git-repl(1) git-repl git-reset-file(1) git-reset-file git-setup(1) git-setup +git-show-merged-branches(1) git-show-merged-branches git-show-tree(1) git-show-tree +git-show-unmerged-branches(1) git-show-unmerged-branches git-squash(1) git-squash git-summary(1) git-summary git-touch(1) git-touch From 3330af6cd405d289595e7ce08b6402a7002a68f0 Mon Sep 17 00:00:00 2001 From: spacewander Date: Sun, 22 Mar 2015 22:55:15 +0800 Subject: [PATCH 063/804] sort unless there is only one item --- bin/git-effort | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/git-effort b/bin/git-effort index 4fb298165..ac55d279f 100755 --- a/bin/git-effort +++ b/bin/git-effort @@ -137,7 +137,9 @@ trap show_cursor_and_cleanup INT # loop files heading -effort "${files[@]}" | tee $tmp && sort_effort + +effort "${files[@]}" | tee $tmp +test "$(wc -l $tmp | cut -d' ' -f1 )" -gt 1 && sort_effort echo show_cursor_and_cleanup From 888919c2e9adc1f2bff0fed771facce00ad36db5 Mon Sep 17 00:00:00 2001 From: spacewander Date: Fri, 3 Apr 2015 00:34:11 +0800 Subject: [PATCH 064/804] add git-guilt --- bin/git-guilt | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100755 bin/git-guilt diff --git a/bin/git-guilt b/bin/git-guilt new file mode 100755 index 000000000..90333d4a0 --- /dev/null +++ b/bin/git-guilt @@ -0,0 +1,112 @@ +#!/bin/bash + +for param in $* +do + case $param in + -h|--help ) + echo 'Usage: git-guilt [] ' + echo 'Calculates the change in blame between two revisions' + echo 'Example: git guilt HEAD~3 HEAD' + echo + echo 'Options:' + echo + echo ' -h, --help output usage information' + echo ' -e, --email display author emails instead of names' + echo ' -w, --ignore-whitespace ignore whitespace only changes when attributing blame' + echo ' -d, --debug output debug information' + exit 0 + ;; + -e|--email ) + EMAIL='-e' + shift + ;; + -w|--ignore-whitespace ) + NOT_WHITESPACE='-w' + shift + ;; + -d|--debug ) + DEBUG=$(git_extra_mktemp) + shift + ;; + esac +done + +cd "$(git-root)" # cd for git blame +SINCE_LOG=$(git_extra_mktemp) +UNTIL_LOG=$(git_extra_mktemp) +for file in $(git diff --name-only "$@") +do + test -n "$DEBUG" && echo "git blame $file" + # $1 - since $2 - until + git blame $NOT_WHITESPACE --line-porcelain "$1" -- "$file" 2> /dev/null >> $SINCE_LOG + git blame $NOT_WHITESPACE --line-porcelain "$2" -- "$file" 2> /dev/null >> $UNTIL_LOG +done + +MERGED_LOG=$(git_extra_mktemp) +if [[ $EMAIL == '-e' ]] +then + PATTERN='s/^author-mail <\(.*\)>/\1/p' +else + PATTERN='s/^author //p' +fi +sed -n "$PATTERN" $SINCE_LOG | sed 's/^\(.\)/- \1/' >> $MERGED_LOG +sed -n "$PATTERN" $UNTIL_LOG | sed 's/^\(.\)/+ \1/' >> $MERGED_LOG + +DEBUG="$DEBUG" awk ' +NR==1 { + # the index of $2 does not change in each line + name_start_at = index($0, $2) +} +/^\+/ { + contributors[substr($0, name_start_at)]++ +} +/^-/ { + contributors[substr($0, name_start_at)]-- +} +END { +print ENVIRON["DEBUG"] + for (people in contributors) { + if (ENVIRON["DEBUG"]) { + printf("%d %s\n", contributors[people], people) >> ENVIRON["DEBUG"] + } + if (contributors[people] != 0) { + printf("%d %s\n", contributors[people], people) + } + } +}' $MERGED_LOG | sort -nr | # only gawk supports built-in sort function +awk ' +BEGIN { MAX = 50 } +/^-?[[:digit:]]+ / { + people = substr($0, index($0, $2)) + if ($1 > 0) { + printf("%-29s \033[00;32m", people) + if ($1 < MAX) { + for (i = 0; i < $1; i++) + printf("+") + } + else { + bound = MAX - length($1) - 2 + for (i = 0; i < bound; i++) + printf("+") + printf("(%d)", $1) + } + printf("\033[00m\n") + } + else { + printf("%-29s \033[00;31m", people) + deletes = -$1 + if (deletes < MAX) { + for (i = 0; i < deletes; i++) + printf("-") + } + else { + bound = MAX - length(deletes) - 2 + for (i = 0; i < bound; i++) + printf("-") + printf("(%d)", deletes) + } + printf("\033[00m\n") + } +}' + +test -n "$DEBUG" && sort -nr "$DEBUG" From 9f24b17b4af5eb102dea9207ccb84afb1cdd8050 Mon Sep 17 00:00:00 2001 From: spacewander Date: Mon, 6 Apr 2015 16:23:01 +0800 Subject: [PATCH 065/804] add docs for git guilt --- man/git-guilt.1 | 97 ++++++++++++++++++++++++++++ man/git-guilt.html | 153 +++++++++++++++++++++++++++++++++++++++++++++ man/git-guilt.md | 66 +++++++++++++++++++ 3 files changed, 316 insertions(+) create mode 100644 man/git-guilt.1 create mode 100644 man/git-guilt.html create mode 100644 man/git-guilt.md diff --git a/man/git-guilt.1 b/man/git-guilt.1 new file mode 100644 index 000000000..9ef5075cf --- /dev/null +++ b/man/git-guilt.1 @@ -0,0 +1,97 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-GUILT" "1" "April 2015" "" "Git Extras" +. +.SH "NAME" +\fBgit\-guilt\fR \- calculate change between two revisions +. +.SH "SYNOPSIS" +git guilt [