From c783733e1693235276ddd1dfe77fce8ad14f6de4 Mon Sep 17 00:00:00 2001 From: spacewander Date: Wed, 27 Jul 2016 00:05:44 +0800 Subject: [PATCH 1/6] add git-show-(un)merged-branches to Commands.md --- Commands.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Commands.md b/Commands.md index 8159188..a177c84 100644 --- a/Commands.md +++ b/Commands.md @@ -42,6 +42,12 @@ - [`git scp`](#git-scp) - [`git sed`](#git-sed) - [`git setup`](#git-setup) +<<<<<<< HEAD +======= + - [`git show-merged-branches`](#git-show-merged-branches) + - [`git show-unmerged-branches`](#git-show-unmerged-branches) + - [`git show-tree`](#git-show-tree) +>>>>>>> 7c693c3... add git-show-(un)merged-branches to Commands.md - [`git standup`](#git-standup) - [`git squash`](#git-squash) - [`git summary`](#git-summary) @@ -795,6 +801,37 @@ Internally this script uses `rsync` and not `scp` as the name suggests. $ git scp staging js/vendor/ +## git show-merged-branches + +Show all branches merged in to current HEAD. + +## git show-unmerged-branches + +Show all branches **not** merged in to current HEAD. + +## git show-tree + +Show the decorated graph view of one liner summarized commits from all branches. +For example, running `git show-tree` will display: +``` +* 4b57684 (HEAD, develop) Merge branch upstream master. +|\ +| * 515e94a Merge pull request #128 from nickl-/git-extras-html-hyperlinks +| |\ +| | * 815db8b (nickl/git-extras-html-hyperlinks, git-extras-html-hyperlinks) help ronn make hyperlinks. +| * | 7398d10 (nickl/develop) Fix #127 git-ignore won't add duplicates. +| |/ +| | * ab72c1e (refs/stash) WIP on develop: 5e943f5 Fix #127 git-ignore won't add duplicates. +| |/ +|/| +* | 730ca89 (bolshakov) Rebase bolshakov with master +|/ +* 60f8371 (origin/master, origin/HEAD, master) Merge pull request #126 from agrimaldi/fix-changelog-last-tag +... +``` + +Be free to try it for yourself! + ## git standup Recall what you did or find what someone else did in a given range of time. From b33f85a5d15f594b29aeec7341074be0b08adffc Mon Sep 17 00:00:00 2001 From: spacewander Date: Wed, 27 Jul 2016 00:07:03 +0800 Subject: [PATCH 2/6] follow common shebang --- bin/git-release | 2 +- bin/git-sed | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/git-release b/bin/git-release index e6869f9..5836cdf 100755 --- a/bin/git-release +++ b/bin/git-release @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash hook() { local hook=.git/hooks/$1.sh diff --git a/bin/git-sed b/bin/git-sed index 966e643..f72f440 100755 --- a/bin/git-sed +++ b/bin/git-sed @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash usage() { cat < Date: Wed, 27 Jul 2016 00:08:39 +0800 Subject: [PATCH 3/6] regenerate git-obliterate doc --- man/git-obliterate.1 | 2 +- man/{git-obliterate.1.html => git-obliterate.html} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename man/{git-obliterate.1.html => git-obliterate.html} (91%) diff --git a/man/git-obliterate.1 b/man/git-obliterate.1 index b1b6487..d4cd0ec 100644 --- a/man/git-obliterate.1 +++ b/man/git-obliterate.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "GIT\-OBLITERATE" "1" "August 2015" "" "" +.TH "GIT\-OBLITERATE" "1" "June 2016" "" "" . .SH "NAME" \fBgit\-obliterate\fR \- rewrite past commits to remove some files diff --git a/man/git-obliterate.1.html b/man/git-obliterate.html similarity index 91% rename from man/git-obliterate.1.html rename to man/git-obliterate.html index 649128d..9def756 100644 --- a/man/git-obliterate.1.html +++ b/man/git-obliterate.html @@ -107,7 +107,7 @@ And it will mess up stash, so don't have stash when you run git ob

AUTHOR

-

Written by <brianloveswords@gmail.com>

+

Written by <brianloveswords@gmail.com>

REPORTING BUG

@@ -120,7 +120,7 @@ And it will mess up stash, so don't have stash when you run git ob
  1. -
  2. August 2015
  3. +
  4. June 2016
  5. git-obliterate(1)
From 88902b7586ac94d2d5b0f4c6690ad4c8444bf610 Mon Sep 17 00:00:00 2001 From: spacewander Date: Wed, 27 Jul 2016 00:11:16 +0800 Subject: [PATCH 4/6] add git-back to Commands.md --- Commands.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Commands.md b/Commands.md index a177c84..0711d4f 100644 --- a/Commands.md +++ b/Commands.md @@ -2,6 +2,7 @@ - [`git alias`](#git-alias) - [`git archive-file`](#git-archive-file) - [`git authors`](#git-authors) + - [`git back`](#git-back) - [`git changelog`](#git-changelog) - [`git clear`](#git-clear) - [`git clear-soft`](#git-clear-soft) @@ -659,6 +660,15 @@ nickl- Leila Muhtasib ``` +## git back + +Removes the latest commits, and add their changes to your staging area. + +``` +$ git back # Removes the latest commit. +$ git back 3 # Remove the latest 3 commits. +``` + ## git changelog Generates 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 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 **$EDITOR** when set. From a062420224b81a5ce16e6cb6afdfb1f255d5c116 Mon Sep 17 00:00:00 2001 From: spacewander Date: Wed, 27 Jul 2016 00:20:25 +0800 Subject: [PATCH 5/6] add git-release-patch to Commands.md --- Commands.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Commands.md b/Commands.md index 0711d4f..c59c8d4 100644 --- a/Commands.md +++ b/Commands.md @@ -36,6 +36,7 @@ - [`git obliterate`](#git-obliterate) - [`git pr`](#git-pr) - [`git psykorebase`](#git-psykorebase) + - [`git rebase-patch`](#git-rebase-patch) - [`git release`](#git-release) - [`git repl`](#git-repl) - [`git reset-file`](#git-reset-file) @@ -1049,6 +1050,25 @@ $ git psykorebase master feature The above rebase `feature` branch on top of `master` branch +## git rebase-patch + +Given you have a patch that doesn´t apply to the current HEAD, but you know it applied to some commit in the past, +`git rebase-patch` will help you find that commit and do a rebase. + +For example, +``` +$ 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 +``` + +Then your last commit has the changes of the patch and is named `test.patch`. + ## git sync Sync local branch with its remote branch From 66560432ce466547d3ed32282680d0ac479c1889 Mon Sep 17 00:00:00 2001 From: spacewander Date: Thu, 28 Jul 2016 00:08:20 +0800 Subject: [PATCH 6/6] add doc for git-pull-request and others --- Commands.md | 32 ++++++++- bin/git-fork | 2 +- bin/git-pull-request | 8 ++- etc/git-extras-completion.zsh | 1 + man/git-pull-request.1 | 46 ++++++++++++ man/git-pull-request.html | 127 ++++++++++++++++++++++++++++++++++ man/git-pull-request.md | 44 ++++++++++++ 7 files changed, 255 insertions(+), 5 deletions(-) create mode 100644 man/git-pull-request.1 create mode 100644 man/git-pull-request.html create mode 100644 man/git-pull-request.md diff --git a/Commands.md b/Commands.md index c59c8d4..90ddc98 100644 --- a/Commands.md +++ b/Commands.md @@ -36,20 +36,19 @@ - [`git obliterate`](#git-obliterate) - [`git pr`](#git-pr) - [`git psykorebase`](#git-psykorebase) + - [`git pull-request`](#git-pull-request) - [`git rebase-patch`](#git-rebase-patch) - [`git release`](#git-release) + - [`git rename-tag`](#git-rename-tag) - [`git repl`](#git-repl) - [`git reset-file`](#git-reset-file) - [`git root`](#git-root) - [`git scp`](#git-scp) - [`git sed`](#git-sed) - [`git setup`](#git-setup) -<<<<<<< HEAD -======= - [`git show-merged-branches`](#git-show-merged-branches) - [`git show-unmerged-branches`](#git-show-unmerged-branches) - [`git show-tree`](#git-show-tree) ->>>>>>> 7c693c3... add git-show-(un)merged-branches to Commands.md - [`git standup`](#git-standup) - [`git squash`](#git-squash) - [`git summary`](#git-summary) @@ -348,6 +347,29 @@ Does the following: - Push the branch / tags - Executes _.git/hooks/post-release.sh_ (if present) +## git rename-tag + +Rename a tag (locally and remotely). +``` +$ git tag test +$ git push --tags +Total 0 (delta 0), reused 0 (delta 0) +To git@myserver.com:myuser/myrepository.git + * [new tag] test -> test +$ git tag +test +$ git rename-tag test test2 +Deleted tag 'test' (was 1111111) +Total 0 (delta 0), reused 0 (delta 0) +To git@myserver.com:myuser/myrepository.git + * [new tag] test2 -> test2 +remote: warning: Deleting a non-existent ref. +To git@myserver.com:myuser/myrepository.git + - [deleted] refs/tag/test +$ git tag +test2 +``` + ## git alias Define, search and show aliases. @@ -1050,6 +1072,10 @@ $ git psykorebase master feature The above rebase `feature` branch on top of `master` branch +## git pull-request + +Create pull request via commandline. + ## git rebase-patch Given you have a patch that doesn´t apply to the current HEAD, but you know it applied to some commit in the past, diff --git a/bin/git-fork b/bin/git-fork index 0981488..b05cb05 100755 --- a/bin/git-fork +++ b/bin/git-fork @@ -20,7 +20,7 @@ read user # extract owner + project from repo url project=${url##*/} owner=${url%/$project} -[[ $project == *.git ]] && project=${project%.git} +project=${project%.git} if [[ $owner == git@* ]]; then owner=${owner##*:} else diff --git a/bin/git-pull-request b/bin/git-pull-request index e9a2e44..72e8a9d 100755 --- a/bin/git-pull-request +++ b/bin/git-pull-request @@ -39,7 +39,13 @@ git push origin $branch || abort "failed to push $branch" # lame hack to get project -project=$(git config remote.origin.url | sed 's/^.*://' | sed 's/\.git$//') +origin=$(git config remote.origin.url) +if [[ $origin == git@* ]]; then + project=${origin##*:} +else + project=${origin#https://*/} +fi +project=${project%.git} # prompt diff --git a/etc/git-extras-completion.zsh b/etc/git-extras-completion.zsh index 84ccc1b..b6dec9b 100644 --- a/etc/git-extras-completion.zsh +++ b/etc/git-extras-completion.zsh @@ -389,6 +389,7 @@ zstyle ':completion:*:*:git:*' user-commands \ obliterate:'rewrite past commits to remove some files' \ pr:'checks out a pull request locally' \ psykorebase:'rebase a branch with a merge commit' \ + pull-request:'create pull request to GitHub project' \ rebase-patch:'rebases a patch' \ refactor:'create refactor branch' \ release:'commit, tag and push changes to the repository' \ diff --git a/man/git-pull-request.1 b/man/git-pull-request.1 new file mode 100644 index 0000000..f4390cd --- /dev/null +++ b/man/git-pull-request.1 @@ -0,0 +1,46 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-PULL\-REQUEST" "1" "July 2016" "" "" +. +.SH "NAME" +\fBgit\-pull\-request\fR \- Create pull request for GitHub project +. +.SH "SYNOPSIS" +\fBgit\-pull\-request\fR [] +. +.SH "DESCRIPTION" +Create pull request for a project on GitHub via commandline\. +. +.SH "OPTIONS" + +. +.P +The target branch you want to send pull request to\. +. +.SH "EXAMPLES" +. +.nf + +$ git pull\-request master +Everything up\-to\-date + + create pull\-request for spacewander/spacewander\-toolbox \'master\' + + title: test + body: + base [master]: + +Enter host password for user \'spacewanderlzx@gmail\.com\': +\.\.\. +. +.fi +. +.SH "AUTHOR" +Written by Tj Holowaychuk <\fItj@vision\-media\.ca\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-pull-request.html b/man/git-pull-request.html new file mode 100644 index 0000000..e190e72 --- /dev/null +++ b/man/git-pull-request.html @@ -0,0 +1,127 @@ + + + + + + git-pull-request(1) - Create pull request for GitHub project + + + + +
+ + + +
    +
  1. git-pull-request(1)
  2. +
  3. +
  4. git-pull-request(1)
  5. +
+ +

NAME

+

+ git-pull-request - Create pull request for GitHub project +

+ +

SYNOPSIS

+ +

git-pull-request [<target branch>]

+ +

DESCRIPTION

+ +

Create pull request for a project on GitHub via commandline.

+ +

OPTIONS

+ +

<target branch>

+ +

The target branch you want to send pull request to.

+ +

EXAMPLES

+ +
$ git pull-request master
+Everything up-to-date
+
+  create pull-request for spacewander/spacewander-toolbox 'master'
+
+  title: test
+  body:  
+  base [master]: 
+
+Enter host password for user 'spacewanderlzx@gmail.com':
+...
+
+ +

AUTHOR

+ +

Written by Tj Holowaychuk <tj@vision-media.ca>

+ +

REPORTING BUGS

+ +

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

+ +

SEE ALSO

+ +

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

+ + +
    +
  1. +
  2. July 2016
  3. +
  4. git-pull-request(1)
  5. +
+ +
+ + diff --git a/man/git-pull-request.md b/man/git-pull-request.md new file mode 100644 index 0000000..133242c --- /dev/null +++ b/man/git-pull-request.md @@ -0,0 +1,44 @@ +git-pull-request(1) -- Create pull request for GitHub project +================================ + +## SYNOPSIS + +`git-pull-request` [<target branch>] + +## DESCRIPTION + +Create pull request for a project on GitHub via commandline. + +## OPTIONS + +<target branch> + +The target branch you want to send pull request to. + +## EXAMPLES + +``` +$ git pull-request master +Everything up-to-date + + create pull-request for spacewander/spacewander-toolbox 'master' + + title: test + body: + base [master]: + +Enter host password for user 'spacewanderlzx@gmail.com': +... +``` + +## AUTHOR + +Written by Tj Holowaychuk <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<>