shell/fzf: add bin/fzf-git-{log,sha}
This commit is contained in:
parent
8f641a3149
commit
5a65cc9960
10
shell/fzf/bin/fzf-git-log
Executable file
10
shell/fzf/bin/fzf-git-log
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
git log --graph --color=always \
|
||||
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
|
||||
fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \
|
||||
--bind "ctrl-m:execute:
|
||||
(grep -o '[a-f0-9]\{7\}' | head -1 |
|
||||
xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF'
|
||||
{}
|
||||
FZF-EOF"
|
11
shell/fzf/bin/fzf-git-sha
Executable file
11
shell/fzf/bin/fzf-git-sha
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Retrieves a git commit's SHA, useful for a variety of git commands.
|
||||
#
|
||||
# Examples:
|
||||
# + git checkout `fzf-git-sha`
|
||||
# + git commit --fixup `fzf-git-sha`
|
||||
|
||||
commits=$(git log --color=always --pretty=oneline --abbrev-commit --reverse) &&
|
||||
commit=$(echo "$commits" | fzf --tac +s +m -e --ansi --reverse) &&
|
||||
echo -n $(echo "$commit" | sed "s/ .*//")
|
Loading…
Reference in a new issue