From 5b62b4a8842e1cdae1c454e7a4b9a999805a7565 Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Mon, 6 Nov 2017 14:02:23 +0800 Subject: [PATCH 1/2] Add git-paste for sending patches to pastebin --- Commands.md | 25 +++++++++++++++++ bin/git-paste | 5 ++++ etc/git-extras-completion.zsh | 1 + man/git-paste.md | 51 +++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100755 bin/git-paste create mode 100644 man/git-paste.md diff --git a/Commands.md b/Commands.md index e7c2487..eb9b7c8 100644 --- a/Commands.md +++ b/Commands.md @@ -39,6 +39,7 @@ - [`git missing`](#git-missing) - [`git mr`](#git-mr) - [`git obliterate`](#git-obliterate) + - [`git paste`](#git-paste) - [`git pr`](#git-pr) - [`git psykorebase`](#git-psykorebase) - [`git pull-request`](#git-pull-request) @@ -1273,6 +1274,30 @@ Switched to branch 'mr/51' Just like [git pr](#git-pr), `git mr` accepts a `clean` argument to trash all `mr/` branches. Ensure current branch is not one. +## git paste + +Sends commits to a pastebin site using pastebinit. + +By default it sends the commits between your current branch +and the branch your current branch is based on (the upstream branch). + +``` bash +$ git paste +https://paste.debian.net/1234567/ +``` + +All options are passed to `git format-patch --stdout` +so you can also pass options understood by `git-rev-parse(1)` +in order to select a different set of commits. + +``` bash +$ git paste @^ +https://paste.debian.net/1234567/ +``` + +See the [pastebinit documentation](https://manpages.debian.org/pastebinit) +for information about how to chose a different pastebin site to the default. + ## git pr Checks out a pull request from GitHub diff --git a/bin/git-paste b/bin/git-paste new file mode 100755 index 0000000..1b1c5ce --- /dev/null +++ b/bin/git-paste @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -e +set -o pipefail +test $# -ne 0 || set -- '@{u}' +git format-patch --stdout "$@" | pastebinit -f diff diff --git a/etc/git-extras-completion.zsh b/etc/git-extras-completion.zsh index 672ded7..dd3c180 100644 --- a/etc/git-extras-completion.zsh +++ b/etc/git-extras-completion.zsh @@ -476,6 +476,7 @@ zstyle ':completion:*:*:git:*' user-commands $existing_user_commands \ missing:'show commits missing from another branch' \ mr:'checks out a merge request locally' \ obliterate:'rewrite past commits to remove some files' \ + paste:'send patches to pastebin sites' \ pr:'checks out a pull request locally' \ psykorebase:'rebase a branch with a merge commit' \ pull-request:'create pull request to GitHub project' \ diff --git a/man/git-paste.md b/man/git-paste.md new file mode 100644 index 0000000..76a37e6 --- /dev/null +++ b/man/git-paste.md @@ -0,0 +1,51 @@ +git-paste(1) -- Send patches to pastebin for chat conversations +=============================================================== + +## SYNOPSIS + +`git-paste` <git format-patch options> + +## DESCRIPTION + + Send patches to pastebin for chat conversations using pastebinit. + The syntax highlighting will be set to 'diff'. + +## OPTIONS + + <git format-patch options> + + All options are passed directly to `git format-patch`. + Given no arguments, `git-paste` passes `@{u}` to `git format-patch`. + +## CONFIGURATION + + The pastebinit software chooses the most appropriate pastebin site + for your operating system and the [pastebinit documentation](https://manpages.debian.org/pastebinit) + contains details of how to configure it to use a different site. + +## EXAMPLES + + Pastebin the patches between the current branch and its upstream: + + $ git paste + $ git paste @{u} + + Pastebin the latest commit: + + $ git paste -1 + + Pastebin the latest three commits: + + $ git paste -3 + +## AUTHOR + +Written by Paul Wise <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> From d90b02ce220239109193bf8fd5ab6a366fd86ef0 Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Sat, 7 Sep 2019 11:14:30 +0800 Subject: [PATCH 2/2] Regenerate docs Changes-by: make man/git-paste.{1,html} --- man/git-extras.md | 1 + man/git-paste.1 | 43 ++++++++++++++ man/git-paste.html | 139 +++++++++++++++++++++++++++++++++++++++++++++ man/index.txt | 1 + 4 files changed, 184 insertions(+) create mode 100644 man/git-paste.1 create mode 100644 man/git-paste.html diff --git a/man/git-extras.md b/man/git-extras.md index 788653d..1acaffe 100644 --- a/man/git-extras.md +++ b/man/git-extras.md @@ -60,6 +60,7 @@ git-extras(1) -- Awesome GIT utilities - **git-missing(1)** Show commits missing from another branch - **git-mr(1)** Checks out a merge request locally - **git-obliterate(1)** rewrite past commits to remove some files + - **git-paste(1)** Send patches to pastebin for chat conversations - **git-pr(1)** Checks out a pull request locally - **git-psykorebase(1)** Rebase a branch with a merge commit - **git-pull-request(1)** Create pull request for GitHub project diff --git a/man/git-paste.1 b/man/git-paste.1 new file mode 100644 index 0000000..1466e6c --- /dev/null +++ b/man/git-paste.1 @@ -0,0 +1,43 @@ +.\" generated with Ronn-NG/v0.8.0 +.\" http://github.com/apjanke/ronn-ng/tree/0.8.0 +.TH "GIT\-PASTE" "1" "September 2019" "" "Git Extras" +.SH "NAME" +\fBgit\-paste\fR \- Send patches to pastebin for chat conversations +.SH "SYNOPSIS" +\fBgit\-paste\fR +.SH "DESCRIPTION" +Send patches to pastebin for chat conversations using pastebinit\. The syntax highlighting will be set to \'diff\'\. +.SH "OPTIONS" + +.P +All options are passed directly to \fBgit format\-patch\fR\. Given no arguments, \fBgit\-paste\fR passes \fB@{u}\fR to \fBgit format\-patch\fR\. +.SH "CONFIGURATION" +The pastebinit software chooses the most appropriate pastebin site for your operating system and the pastebinit documentation \fI\%https://manpages\.debian\.org/pastebinit\fR contains details of how to configure it to use a different site\. +.SH "EXAMPLES" +Pastebin the patches between the current branch and its upstream: +.IP "" 4 +.nf +$ git paste +$ git paste @{u} +.fi +.IP "" 0 +.P +Pastebin the latest commit: +.IP "" 4 +.nf +$ git paste \-1 +.fi +.IP "" 0 +.P +Pastebin the latest three commits: +.IP "" 4 +.nf +$ git paste \-3 +.fi +.IP "" 0 +.SH "AUTHOR" +Written by Paul Wise <\fI\%mailto:pabs3@bonedaddy\.net\fR> +.SH "REPORTING BUGS" +<\fI\%https://github\.com/tj/git\-extras/issues\fR> +.SH "SEE ALSO" +<\fI\%https://github\.com/tj/git\-extras\fR> diff --git a/man/git-paste.html b/man/git-paste.html new file mode 100644 index 0000000..978c679 --- /dev/null +++ b/man/git-paste.html @@ -0,0 +1,139 @@ + + + + + + git-paste(1) - Send patches to pastebin for chat conversations + + + + +
+ + + +
    +
  1. git-paste(1)
  2. +
  3. Git Extras
  4. +
  5. git-paste(1)
  6. +
+ + + +

NAME

+

+ git-paste - Send patches to pastebin for chat conversations +

+

SYNOPSIS

+ +

git-paste <git format-patch options>

+ +

DESCRIPTION

+ +

Send patches to pastebin for chat conversations using pastebinit. + The syntax highlighting will be set to 'diff'.

+ +

OPTIONS

+ +

<git format-patch options>

+ +

All options are passed directly to git format-patch. + Given no arguments, git-paste passes @{u} to git format-patch.

+ +

CONFIGURATION

+ +

The pastebinit software chooses the most appropriate pastebin site + for your operating system and the pastebinit documentation + contains details of how to configure it to use a different site.

+ +

EXAMPLES

+ +

Pastebin the patches between the current branch and its upstream:

+ +
$ git paste
+$ git paste @{u}
+
+ +

Pastebin the latest commit:

+ +
$ git paste -1
+
+ +

Pastebin the latest three commits:

+ +
$ git paste -3
+
+ +

AUTHOR

+ +

Written by Paul Wise <pabs3@bonedaddy.net>

+ +

REPORTING BUGS

+ +

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

+ +

SEE ALSO

+ +

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

+ +
    +
  1. +
  2. September 2019
  3. +
  4. git-paste(1)
  5. +
+ +
+ + diff --git a/man/index.txt b/man/index.txt index f4ab5c0..8b7bac4 100644 --- a/man/index.txt +++ b/man/index.txt @@ -39,6 +39,7 @@ git-merge-repo(1) git-merge-repo git-missing(1) git-missing git-mr(1) git-mr git-obliterate(1) git-obliterate +git-paste(1) git-paste git-pr(1) git-pr git-psykorebase(1) git-psykorebase git-pull-request(1) git-pull-request