12 lines
373 B
Plaintext
12 lines
373 B
Plaintext
|
#!/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/ .*//")
|