Add git-abort

New subcommand just calls git $op --abort, where $op is current git operation, like rebase
This commit is contained in:
Przemek Kitszel 2020-08-05 22:40:11 +02:00
parent b225ed4934
commit b8e58ee9ba
8 changed files with 188 additions and 0 deletions

View file

@ -1,4 +1,5 @@
- [`git abort`](#git-abort)
- [`git alias`](#git-alias)
- [`git archive-file`](#git-archive-file)
- [`git authors`](#git-authors)
@ -1539,3 +1540,7 @@ total 308
-rwxr-xr-x 1 vt vt 18561 Sep 5 2019 git-changelog
-rwxr-xr-x 1 vt vt 215 Nov 19 2016 git-clear
```
## git abort
Abort current rebase, merge or cherry-pick, without the need to find exact command in history.

17
bin/git-abort Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
gitdir="$(git rev-parse --git-dir)" || exit
opfound=
fcnt=
for i in cherry-pick merge rebase; do
f=${i^^}
f=${f/-/_}
test -f "${gitdir}/${f}_HEAD" && fcnt=1$fcnt && opfound=$i
done
if [ "${fcnt}" != 1 ]; then
echo "I don't know what to abort" >&2
exit 1
fi
git "${opfound}" --abort

View file

@ -335,6 +335,7 @@ zstyle -g existing_user_commands ':completion:*:*:git:*' user-commands
zstyle ':completion:*:*:git:*' user-commands $existing_user_commands \
alias:'define, search and show aliases' \
abort:'abort current merge, rebase, or cherry-pick process' \
archive-file:'export the current head of the git repository to an archive' \
authors:'generate authors report' \
browse:'open repo website in browser' \

19
man/git-abort.1 Normal file
View file

@ -0,0 +1,19 @@
.\" generated with Ronn-NG/v0.8.0
.\" http://github.com/apjanke/ronn-ng/tree/0.8.0
.TH "GIT\-ABORT" "1" "August 2020" "" "Git Extras"
.SH "NAME"
\fBgit\-abort\fR \- Abort current git operation
.SH "SYNOPSIS"
\fBgit\-abort\fR
.SH "DESCRIPTION"
Abort current git rebase, merge or cherry\-pick process\.
.SH "OPTIONS"
There are no options, it just aborts current operation\.
.SH "EXAMPLES"
\fBgit\-abort\fR
.SH "AUTHOR"
Written by Przemek Kitszel <\fI\%mailto:pkitszel@gmail\.com\fR>
.SH "REPORTING BUGS"
<\fI\%https://github\.com/tj/git\-extras/issues\fR>
.SH "SEE ALSO"
<\fI\%https://github\.com/tj/git\-extras\fR>

114
man/git-abort.html Normal file
View file

@ -0,0 +1,114 @@
<!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-abort(1) - Abort current git operation</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="#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-abort(1)</li>
<li class='tc'>Git Extras</li>
<li class='tr'>git-abort(1)</li>
</ol>
<h2 id="NAME">NAME</h2>
<p class="man-name">
<code>git-abort</code> - <span class="man-whatis">Abort current git operation</span>
</p>
<h2 id="SYNOPSIS">SYNOPSIS</h2>
<p><code>git-abort</code></p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
<p> Abort current git rebase, merge or cherry-pick process.</p>
<h2 id="OPTIONS">OPTIONS</h2>
<p> There are no options, it just aborts current operation.</p>
<h2 id="EXAMPLES">EXAMPLES</h2>
<p> <code>git-abort</code></p>
<h2 id="AUTHOR">AUTHOR</h2>
<p>Written by Przemek Kitszel &lt;<a href="mailto:pkitszel@gmail.com" data-bare-link="true">pkitszel@gmail.com</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'>August 2020</li>
<li class='tr'>git-abort(1)</li>
</ol>
</div>
</body>
</html>

30
man/git-abort.md Normal file
View file

@ -0,0 +1,30 @@
git-abort(1) -- Abort current git operation
================================
## SYNOPSIS
`git-abort`
## DESCRIPTION
Abort current git rebase, merge or cherry-pick process.
## OPTIONS
There are no options, it just aborts current operation.
## EXAMPLES
`git-abort`
## AUTHOR
Written by Przemek Kitszel &lt;<pkitszel@gmail.com>&gt;
## REPORTING BUGS
&lt;<https://github.com/tj/git-extras/issues>&gt;
## SEE ALSO
&lt;<https://github.com/tj/git-extras>&gt;

View file

@ -27,6 +27,7 @@ git-extras(1) -- Awesome GIT utilities
## COMMANDS
- **git-abort(1)** Abort current git operation
- **git-alias(1)** Define, search and show aliases
- **git-archive-file(1)** Export the current HEAD of the git repository to an archive
- **git-authors(1)** Generate authors report

View file

@ -1,4 +1,5 @@
# manuals
git-abort(1) git-abort
git-alias(1) git-alias
git-archive-file(1) git-archive-file
git-authors(1) git-authors