-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add git-continue Also refactor `git-abort` to parse action from the called file name. There's a promise for this in #865 but that was a long time ago. * fix: add git-continue address review comments, fix the script, remove unnecessary testpath import.
- Loading branch information
Showing
14 changed files
with
314 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
- [`git clear-soft`](#git-clear-soft) | ||
- [`git coauthor`](#git-coauthor) | ||
- [`git commits-since`](#git-commits-since) | ||
- [`git continue`](#git-continue) | ||
- [`git contrib`](#git-contrib) | ||
- [`git count`](#git-count) | ||
- [`git cp`](#git-cp) | ||
|
@@ -415,9 +416,9 @@ $ git coauthor user [email protected] | |
2 files changed, 145 insertions(+), 0 deletions(-) | ||
create mode 100644 README.md | ||
create mode 100644 CONTRIBUTING.md | ||
|
||
$ git log -1 | ||
|
||
commit b62ceae2685e6ece071f3c3754e9b77fd0a35c88 (HEAD -> master) | ||
Author: user person <[email protected]> | ||
Date: Sat Aug 17 17:33:53 2019 -0500 | ||
|
@@ -1368,7 +1369,7 @@ Switched to branch 'mr/51' | |
With full URL, the head is fetched from a temporary remote pointing to the base URL. | ||
``` bash | ||
$ git mr https://gitlab.com/owner/repository/merge_requests/51 | ||
$ git mr https://gitlab.com/owner/repository/merge_requests/51 | ||
From gitlab.com:owner/repository | ||
* [new ref] refs/merge-requests/51/head -> mr/51 | ||
Switched to branch 'mr/51' | ||
|
@@ -1623,3 +1624,7 @@ Abort current revert, rebase, merge or cherry-pick, without the need to find exa | |
## git magic | ||
Commits changes with a generated message. | ||
## git continue | ||
Continue current revert, rebase, merge or cherry-pick, without the need to find exact command in history. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
gitdir="$(git rev-parse --git-dir)" || exit | ||
opfound= | ||
fcnt= | ||
for i in cherry-pick merge rebase revert; do | ||
f=${i^^} | ||
f=${f/-/_} | ||
test -f "${gitdir}/${f}_HEAD" && fcnt=1$fcnt && opfound=$i | ||
done | ||
set -euo pipefail | ||
|
||
if [ "${fcnt}" != 1 ]; then | ||
echo "I don't know what to abort" >&2 | ||
exit 1 | ||
fi | ||
function discover_op() { | ||
local gitdir | ||
# git rev-parse emits an error if not in a git repo so only need to bail out | ||
gitdir="$(git rev-parse --git-dir)" || exit | ||
local op | ||
for op in cherry_pick merge rebase revert ; do | ||
if [ -f "${gitdir}/${op^^}_HEAD" ]; then | ||
echo "${op/_/-}" | ||
fi | ||
done | ||
} | ||
|
||
git "${opfound}" --abort | ||
function validate_op() { | ||
local op="$1" | ||
if [ -z "$op" ]; then | ||
echo "No active operation found" >&2 | ||
exit 1 | ||
fi | ||
if [[ "$(echo "$op" | wc -l)" -gt 1 ]]; then | ||
echo "Multiple active operations found: $op" >&2 | ||
exit 1 | ||
fi | ||
} | ||
|
||
function discover_action() { | ||
local action=${1/git-/} | ||
if [ "$action" != "abort" ] && [ "$action" != "continue" ]; then | ||
echo "Invalid action: $1" >&2 | ||
exit 1 | ||
fi | ||
echo "$action" | ||
} | ||
|
||
action=$(discover_action "$(basename "$0")") | ||
op=$(discover_op) | ||
validate_op "$op" | ||
|
||
git "$op" "--$action" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
git-abort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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\-CONTINUE" "1" "November 2024" "" "Git Extras" | ||
.SH "NAME" | ||
\fBgit\-continue\fR \- Continue current git operation | ||
.SH "SYNOPSIS" | ||
\fBgit\-continue\fR | ||
.SH "DESCRIPTION" | ||
Continue current git revert, rebase, merge or cherry\-pick process\. | ||
.SH "OPTIONS" | ||
There are no options, it just continues current operation\. | ||
.SH "EXAMPLES" | ||
\fBgit\-continue\fR | ||
.SH "AUTHOR" | ||
Written by oikarinen | ||
.SH "REPORTING BUGS" | ||
<\fI\%https://github\.com/tj/git\-extras/issues\fR> | ||
.SH "SEE ALSO" | ||
<\fI\%https://github\.com/tj/git\-extras\fR> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
git-continue(1) -- Continue current git operation | ||
================================ | ||
|
||
## SYNOPSIS | ||
|
||
`git-continue` | ||
|
||
## DESCRIPTION | ||
|
||
Continue current git revert, rebase, merge or cherry-pick process. | ||
|
||
## OPTIONS | ||
|
||
There are no options, it just continues current operation. | ||
|
||
## EXAMPLES | ||
|
||
`git-continue` | ||
|
||
## AUTHOR | ||
|
||
Written by oikarinen | ||
|
||
## REPORTING BUGS | ||
|
||
<<https://github.com/tj/git-extras/issues>> | ||
|
||
## SEE ALSO | ||
|
||
<<https://github.com/tj/git-extras>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.