#TIL: CLI Tricks for Git with FZF
Does your current process to checkout a Git branch look something like this?
Going through these many steps decreases productivity and makes working with Git a real struggle. The good news is, there is a way to work around this and make the whole process much leaner!
Using FZF, the seven steps listed above become a one-liner: "git branch -a | fzf | xargs git checkout". This opens up an interactive dropdown that you can now easily navigate with arrows and the search input.
The last step to make this even easier to use would be to create an alias for the command, as follows:
"~/.bashrc
alias gb="git branch -a | fzf | xargs git checkout""
You should now be able to use this with a?"gb"?shorthand, making your experience smoother. Happy coding!
If you are looking for a guide on using Git with visual tools like Fork, check out this blog post by Chris Manson : https://mainmatter.com/blog/2021/05/26/keeping-a-clean-git-history/