2017-04-25 14:18:29 -07:00
|
|
|
#!/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`
|
|
|
|
|
2017-05-15 11:41:20 -07:00
|
|
|
commits=$(git log --color=always --abbrev-commit --reverse --format="%C(auto)%h%d %s %C(black)%C(bold)%cr") &&
|
2017-12-05 22:39:10 -08:00
|
|
|
commit=$(echo "$commits" | fzf --tac +s +m -e --ansi) &&
|
|
|
|
echo -n $(echo "$commit" | sed "s/ .*//")
|