Skip to content

Commit

Permalink
Merge pull request #865 from pkitszel/pkitszel-git-abort
Browse files Browse the repository at this point in the history
  • Loading branch information
spacewander authored Jul 8, 2021
2 parents b225ed4 + b8e58ee commit d28ad34
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Commands.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

- [`git abort`](#git-abort)
- [`git alias`](#git-alias)
- [`git archive-file`](#git-archive-file)
- [`git authors`](#git-authors)
Expand Down Expand Up @@ -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 changes: 17 additions & 0 deletions bin/git-abort
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions etc/git-extras-completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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' \
Expand Down
19 changes: 19 additions & 0 deletions man/git-abort.1
Original file line number Diff line number Diff line change
@@ -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 changes: 114 additions & 0 deletions man/git-abort.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions man/git-abort.md
Original file line number Diff line number Diff line change
@@ -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;<[email protected]>&gt;

## REPORTING BUGS

&lt;<https://github.com/tj/git-extras/issues>&gt;

## SEE ALSO

&lt;<https://github.com/tj/git-extras>&gt;
1 change: 1 addition & 0 deletions man/git-extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions man/index.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit d28ad34

Please sign in to comment.