Add git-paste for sending patches to pastebin

This commit is contained in:
Paul Wise 2017-11-06 14:02:23 +08:00
parent f7d127b360
commit 5b62b4a884
No known key found for this signature in database
GPG key ID: 3116BA5E9FFA69A3
4 changed files with 82 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' \

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` <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 &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;