-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add git-continue #1176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add git-continue #1176
Changes from all commits
27ac89b
d359df9
a2cef11
d31583f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. | ||
| 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" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I am reading the code correctly, if |
||
|
|
||
| git "$op" "--$action" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| git-abort |
| 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.
| 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>> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of this function (feel like there is a better way to go about this), but I'm good with this for now.