Created
March 1, 2024 08:31
-
-
Save BlackHole1/f37facb57dca1b25b56729e309aae15c to your computer and use it in GitHub Desktop.
git checkout with fzf
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
# Ref: https://x.com/naoya_ito/status/1763034484843381187?s=20 | |
git for-each-ref refs/tags refs/heads --sort=-committerdate --format="%(if:equals=commit)%(objecttype)%(then)branch%(else)%(objecttype)%(end)˞%(HEAD) %(refname:lstrip=2)˞%(objectname:short)˞%(if)%(upstream:remoteref)%(then) [%(upstream:lstrip=2)]%(end) %(subject) %(upstream:track)" | column -t -s ˞ | fzf -i --layout=reverse --preview-window=down:50% --preview="git show --no-patch --pretty=format:'Date: %ci (%cr)%nAuthor: %an <%ae>%nHash: %H%nBody:%n%b' {2}" | tr '*' ' ' | awk '{print $2}' | xargs -o git checkout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Preview:
