rc tools git: "git apply" to apply selections in diffs
This adds a somewhat discoverable frontend for common uses of the patch command. Here are some frequently used commands # apply selected changes git apply # revert selected changes git apply -R # stage selected changes git apply --cached # unstage selected changes git apply --cached -R # apply selected changes and stage them git apply --index For everyday use that's a lot of typing so I recommend adding mappings.
This commit is contained in:
parent
8c0424b521
commit
286dab11d4
|
@ -49,6 +49,7 @@ define-command -params 1.. \
|
||||||
All the optional arguments are forwarded to the git utility
|
All the optional arguments are forwarded to the git utility
|
||||||
Available commands:
|
Available commands:
|
||||||
add
|
add
|
||||||
|
apply (alias for "patch git apply")
|
||||||
rm
|
rm
|
||||||
reset
|
reset
|
||||||
blame
|
blame
|
||||||
|
@ -69,11 +70,12 @@ define-command -params 1.. \
|
||||||
grep
|
grep
|
||||||
} -shell-script-candidates %{
|
} -shell-script-candidates %{
|
||||||
if [ $kak_token_to_complete -eq 0 ]; then
|
if [ $kak_token_to_complete -eq 0 ]; then
|
||||||
printf "add\nrm\nreset\nblame\ncommit\ncheckout\ndiff\nhide-blame\nhide-diff\nlog\nnext-hunk\nprev-hunk\nshow\nshow-branch\nshow-diff\ninit\nstatus\nupdate-diff\ngrep\n"
|
printf "add\napply\nrm\nreset\nblame\ncommit\ncheckout\ndiff\nhide-blame\nhide-diff\nlog\nnext-hunk\nprev-hunk\nshow\nshow-branch\nshow-diff\ninit\nstatus\nupdate-diff\ngrep\n"
|
||||||
else
|
else
|
||||||
case "$1" in
|
case "$1" in
|
||||||
commit) printf -- "--amend\n--no-edit\n--all\n--reset-author\n--fixup\n--squash\n"; git ls-files -m ;;
|
commit) printf -- "--amend\n--no-edit\n--all\n--reset-author\n--fixup\n--squash\n"; git ls-files -m ;;
|
||||||
add) git ls-files -dmo --exclude-standard ;;
|
add) git ls-files -dmo --exclude-standard ;;
|
||||||
|
apply) printf -- "--reverse\n--cached\n--index\n" ;;
|
||||||
rm|grep) git ls-files -c ;;
|
rm|grep) git ls-files -c ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
@ -309,6 +311,12 @@ define-command -params 1.. \
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
apply)
|
||||||
|
shift
|
||||||
|
enquoted="$(printf '"%s" ' "$@")"
|
||||||
|
echo "require-module patch"
|
||||||
|
echo "patch git apply $enquoted"
|
||||||
|
;;
|
||||||
show|show-branch|log|diff|status)
|
show|show-branch|log|diff|status)
|
||||||
show_git_cmd_output "$@"
|
show_git_cmd_output "$@"
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user