From b8e58ee9ba59312290e2d04aff2fa88afe94ebb2 Mon Sep 17 00:00:00 2001 From: Przemek Kitszel Date: Wed, 5 Aug 2020 22:40:11 +0200 Subject: [PATCH] Add git-abort New subcommand just calls git $op --abort, where $op is current git operation, like rebase --- Commands.md | 5 ++ bin/git-abort | 17 +++++ etc/git-extras-completion.zsh | 1 + man/git-abort.1 | 19 ++++++ man/git-abort.html | 114 ++++++++++++++++++++++++++++++++++ man/git-abort.md | 30 +++++++++ man/git-extras.md | 1 + man/index.txt | 1 + 8 files changed, 188 insertions(+) create mode 100755 bin/git-abort create mode 100644 man/git-abort.1 create mode 100644 man/git-abort.html create mode 100644 man/git-abort.md diff --git a/Commands.md b/Commands.md index d7e8f0f..9e01de1 100644 --- a/Commands.md +++ b/Commands.md @@ -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. diff --git a/bin/git-abort b/bin/git-abort new file mode 100755 index 0000000..abc3ed7 --- /dev/null +++ b/bin/git-abort @@ -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 diff --git a/etc/git-extras-completion.zsh b/etc/git-extras-completion.zsh index ea7cba9..8f0d713 100644 --- a/etc/git-extras-completion.zsh +++ b/etc/git-extras-completion.zsh @@ -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' \ diff --git a/man/git-abort.1 b/man/git-abort.1 new file mode 100644 index 0000000..a4704c0 --- /dev/null +++ b/man/git-abort.1 @@ -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> diff --git a/man/git-abort.html b/man/git-abort.html new file mode 100644 index 0000000..697537a --- /dev/null +++ b/man/git-abort.html @@ -0,0 +1,114 @@ + + + + + + git-abort(1) - Abort current git operation + + + + +
+ + + +
    +
  1. git-abort(1)
  2. +
  3. Git Extras
  4. +
  5. git-abort(1)
  6. +
+ + + +

NAME

+

+ git-abort - 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 <pkitszel@gmail.com>

+ +

REPORTING BUGS

+ +

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

+ +

SEE ALSO

+ +

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

+ +
    +
  1. +
  2. August 2020
  3. +
  4. git-abort(1)
  5. +
+ +
+ + diff --git a/man/git-abort.md b/man/git-abort.md new file mode 100644 index 0000000..0c865da --- /dev/null +++ b/man/git-abort.md @@ -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 <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> diff --git a/man/git-extras.md b/man/git-extras.md index d9e921b..90b74e1 100644 --- a/man/git-extras.md +++ b/man/git-extras.md @@ -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 diff --git a/man/index.txt b/man/index.txt index fc6f88c..b76a90a 100644 --- a/man/index.txt +++ b/man/index.txt @@ -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