mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 07:16:23 -04:00
Reverse order on cherry pick
Git log displays the newest commits on top of the list, while git cherry pick displays the newest commits at the bottom. Reverse the order of git cherry pick so that it has the same order like git log.
This commit is contained in:
parent
1b7db0fb6e
commit
fe5c4d9881
|
|
@ -12,6 +12,11 @@ function forgit::inside_work_tree
|
||||||
git rev-parse --is-inside-work-tree >/dev/null;
|
git rev-parse --is-inside-work-tree >/dev/null;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function forgit::reverse_lines
|
||||||
|
# tac is not available on OSX, tail -r is not available on Linux, so we use either of them
|
||||||
|
tac 2> /dev/null || tail -r
|
||||||
|
end
|
||||||
|
|
||||||
set -g forgit_pager "$FORGIT_PAGER"
|
set -g forgit_pager "$FORGIT_PAGER"
|
||||||
set -g forgit_show_pager "$FORGIT_SHOW_PAGER"
|
set -g forgit_show_pager "$FORGIT_SHOW_PAGER"
|
||||||
set -g forgit_diff_pager "$FORGIT_DIFF_PAGER"
|
set -g forgit_diff_pager "$FORGIT_DIFF_PAGER"
|
||||||
|
|
@ -344,8 +349,8 @@ function forgit::cherry::pick -d "git cherry-picking" --argument-names 'target'
|
||||||
"
|
"
|
||||||
echo $base
|
echo $base
|
||||||
echo $target
|
echo $target
|
||||||
git cherry "$base" "$target" --abbrev -v |
|
git cherry "$base" "$target" --abbrev -v | forgit::reverse_lines |
|
||||||
env FZF_DEFAULT_OPTS="$opts" fzf | cut -d' ' -f2 |
|
env FZF_DEFAULT_OPTS="$opts" fzf | cut -d' ' -f2 | forgit::reverse_lines |
|
||||||
xargs -I% git cherry-pick %
|
xargs -I% git cherry-pick %
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
forgit::warn() { printf "%b[Warn]%b %s\n" '\e[0;33m' '\e[0m' "$@" >&2; }
|
forgit::warn() { printf "%b[Warn]%b %s\n" '\e[0;33m' '\e[0m' "$@" >&2; }
|
||||||
forgit::info() { printf "%b[Info]%b %s\n" '\e[0;32m' '\e[0m' "$@" >&2; }
|
forgit::info() { printf "%b[Info]%b %s\n" '\e[0;32m' '\e[0m' "$@" >&2; }
|
||||||
forgit::inside_work_tree() { git rev-parse --is-inside-work-tree >/dev/null; }
|
forgit::inside_work_tree() { git rev-parse --is-inside-work-tree >/dev/null; }
|
||||||
|
# tac is not available on OSX, tail -r is not available on Linux, so we use either of them
|
||||||
|
forgit::reverse_lines() { (tac 2> /dev/null || tail -r) }
|
||||||
|
|
||||||
# optional render emoji characters (https://github.com/wfxr/emoji-cli)
|
# optional render emoji characters (https://github.com/wfxr/emoji-cli)
|
||||||
hash emojify &>/dev/null && forgit_emojify='|emojify'
|
hash emojify &>/dev/null && forgit_emojify='|emojify'
|
||||||
|
|
@ -159,8 +161,8 @@ forgit::cherry::pick() {
|
||||||
-m -0 --tiebreak=index
|
-m -0 --tiebreak=index
|
||||||
$FORGIT_CHERRY_PICK_FZF_OPTS
|
$FORGIT_CHERRY_PICK_FZF_OPTS
|
||||||
"
|
"
|
||||||
git cherry "$base" "$target" --abbrev -v |
|
git cherry "$base" "$target" --abbrev -v | forgit::reverse_lines |
|
||||||
FZF_DEFAULT_OPTS="$opts" fzf | cut -d' ' -f2 |
|
FZF_DEFAULT_OPTS="$opts" fzf | cut -d' ' -f2 | forgit::reverse_lines |
|
||||||
xargs -I% git cherry-pick %
|
xargs -I% git cherry-pick %
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue