Merge pull request #708 from pabs3/git-paste

Add git-paste for sending patches to pastebin
This commit is contained in:
罗泽轩 2019-09-10 11:24:30 +08:00 committed by GitHub
commit ff0b1cfb0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 266 additions and 0 deletions

View file

@ -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

5
bin/git-paste Executable file
View file

@ -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

View file

@ -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' \

View file

@ -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

43
man/git-paste.1 Normal file
View file

@ -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 <git format\-patch options>
.SH "DESCRIPTION"
Send patches to pastebin for chat conversations using pastebinit\. The syntax highlighting will be set to \'diff\'\.
.SH "OPTIONS"
<git format\-patch 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>

139
man/git-paste.html Normal file
View file

@ -0,0 +1,139 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='content-type' content='text/html;charset=utf8'>
<meta name='generator' content='Ronn-NG/v0.8.0 (http://github.com/apjanke/ronn-ng/tree/0.8.0)'>
<title>git-paste(1) - Send patches to pastebin for chat conversations</title>
<style type='text/css' media='all'>
/* style: man */
body#manpage {margin:0}
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
.mp h2 {margin:10px 0 0 0}
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
.mp h3 {margin:0 0 0 4ex}
.mp dt {margin:0;clear:left}
.mp dt.flush {float:left;width:8ex}
.mp dd {margin:0 0 0 9ex}
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
.mp pre {margin-bottom:20px}
.mp pre+h2,.mp pre+h3 {margin-top:22px}
.mp h2+pre,.mp h3+pre {margin-top:5px}
.mp img {display:block;margin:auto}
.mp h1.man-title {display:none}
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
.mp h2 {font-size:16px;line-height:1.25}
.mp h1 {font-size:20px;line-height:2}
.mp {text-align:justify;background:#fff}
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
.mp u {text-decoration:underline}
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
.mp b.man-ref {font-weight:normal;color:#434241}
.mp pre {padding:0 4ex}
.mp pre code {font-weight:normal;color:#434241}
.mp h2+pre,h3+pre {padding-left:0}
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
ol.man-decor {width:100%}
ol.man-decor li.tl {text-align:left}
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
ol.man-decor li.tr {text-align:right;float:right}
</style>
</head>
<!--
The following styles are deprecated and will be removed at some point:
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
.man-navigation should be used instead.
-->
<body id='manpage'>
<div class='mp' id='man'>
<div class='man-navigation' style='display:none'>
<a href="#NAME">NAME</a>
<a href="#SYNOPSIS">SYNOPSIS</a>
<a href="#DESCRIPTION">DESCRIPTION</a>
<a href="#OPTIONS">OPTIONS</a>
<a href="#CONFIGURATION">CONFIGURATION</a>
<a href="#EXAMPLES">EXAMPLES</a>
<a href="#AUTHOR">AUTHOR</a>
<a href="#REPORTING-BUGS">REPORTING BUGS</a>
<a href="#SEE-ALSO">SEE ALSO</a>
</div>
<ol class='man-decor man-head man head'>
<li class='tl'>git-paste(1)</li>
<li class='tc'>Git Extras</li>
<li class='tr'>git-paste(1)</li>
</ol>
<h2 id="NAME">NAME</h2>
<p class="man-name">
<code>git-paste</code> - <span class="man-whatis">Send patches to pastebin for chat conversations</span>
</p>
<h2 id="SYNOPSIS">SYNOPSIS</h2>
<p><code>git-paste</code> &lt;git format-patch options&gt;</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
<p> Send patches to pastebin for chat conversations using pastebinit.
The syntax highlighting will be set to 'diff'.</p>
<h2 id="OPTIONS">OPTIONS</h2>
<p> &lt;git format-patch options&gt;</p>
<p> All options are passed directly to <code>git format-patch</code>.
Given no arguments, <code>git-paste</code> passes <code>@{u}</code> to <code>git format-patch</code>.</p>
<h2 id="CONFIGURATION">CONFIGURATION</h2>
<p> The pastebinit software chooses the most appropriate pastebin site
for your operating system and the <a href="https://manpages.debian.org/pastebinit">pastebinit documentation</a>
contains details of how to configure it to use a different site.</p>
<h2 id="EXAMPLES">EXAMPLES</h2>
<p> Pastebin the patches between the current branch and its upstream:</p>
<pre><code>$ git paste
$ git paste @{u}
</code></pre>
<p> Pastebin the latest commit:</p>
<pre><code>$ git paste -1
</code></pre>
<p> Pastebin the latest three commits:</p>
<pre><code>$ git paste -3
</code></pre>
<h2 id="AUTHOR">AUTHOR</h2>
<p>Written by Paul Wise &lt;<a href="mailto:pabs3@bonedaddy.net" data-bare-link="true">pabs3@bonedaddy.net</a>&gt;</p>
<h2 id="REPORTING-BUGS">REPORTING BUGS</h2>
<p>&lt;<a href="https://github.com/tj/git-extras/issues" data-bare-link="true">https://github.com/tj/git-extras/issues</a>&gt;</p>
<h2 id="SEE-ALSO">SEE ALSO</h2>
<p>&lt;<a href="https://github.com/tj/git-extras" data-bare-link="true">https://github.com/tj/git-extras</a>&gt;</p>
<ol class='man-decor man-foot man foot'>
<li class='tl'></li>
<li class='tc'>September 2019</li>
<li class='tr'>git-paste(1)</li>
</ol>
</div>
</body>
</html>

51
man/git-paste.md Normal file
View file

@ -0,0 +1,51 @@
git-paste(1) -- Send patches to pastebin for chat conversations
===============================================================
## SYNOPSIS
`git-paste` &lt;git format-patch options&gt;
## DESCRIPTION
Send patches to pastebin for chat conversations using pastebinit.
The syntax highlighting will be set to 'diff'.
## OPTIONS
&lt;git format-patch options&gt;
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 &lt;<pabs3@bonedaddy.net>&gt;
## REPORTING BUGS
&lt;<https://github.com/tj/git-extras/issues>&gt;
## SEE ALSO
&lt;<https://github.com/tj/git-extras>&gt;

View file

@ -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