Created
April 16, 2021 07:58
-
-
Save jmatsu/a8cffbafaebc0c998e0c222e99138258 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Register a filter command for Git commands | |
git config --system --add mine.filter fzf | |
# Show checked-out branches in reflog (distinct, and not sorted by the checked-out time) | |
git config --system --add alias.head-history "\!f() { git reflog HEAD | grep 'checkout:' | awk '\$0=\$NF' | sort | uniq; }; f" | |
# Select and switch HEAD to the branch | |
git config --system --add alias.switch-to "\!f() { local -r ref=\"\$(git head-history | \$(git config --get mine.filter))\"; [[ -n \"\$ref\" ]] && git switch \"\$ref\"; }; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment