DEV Community

Discussion on: Smarter git checkout with fzf

Collapse
anduser96 profile image
Andrei Gatej • Edited on

Interesting alternative!
They way I’ve been dealing with switching between branches is this:

git branch
git checkout ~first-to-letters-or-more~ TAB

After pressing TAB, it should autocomplete. Even If your branches have similar names, you can easily select which one you want.

Collapse
chilcutt profile image
Kyle Chilcutt Author

Nice! I do tend to also do that when the branch names are pretty simple. The few use cases that I find the fzf method particularly helpful for are:

  1. When the branch name is prefixed with an issue tracker ID (e.g. SI3842-add_foo_to_bar)
  2. When I only remember parts of the branch (e.g. "I know I mentioned 'user profile' in the branch name...")

In both of these cases, finding the right match might be difficult with a prefix search!

Collapse
anduser96 profile image
Andrei Gatej

Hmm, I didn’t take those cases into account. I guess here comes my lack of experience.

Thank you for sharing!

Thread Thread
chilcutt profile image
Kyle Chilcutt Author

Please don't apologize! I didn't clearly write out the use cases where this would be useful or detail the specific parts of fzf that make it unique. Your feedback helps me improve my writing and my communication.

Thank you for the comments!