Checkout a branch by its id

twitter logo github logo ・1 min read

When you're working on or peer reviewing or testing, etc more than 2 branches, it's difficult to remember the exact name of every branch and copy/paste is an inefficient option. So, since it's relatively easy to remember the number (id) of the story, we could come up with an alias or better a function to add to our .bashrc, .zshrc or wherever we keep our favourite aliases.

For that, we need to know the id of the branch we want to checkout.
E.g. if the branch is: prefix/PPRJ-123/name-of-the-task, then the id is 123.
Also, we assume the id is unique for the repository.

Gist:

twitter logo DISCUSS
Classic DEV Post from Jun 24

What If I Want My Website to Last for 100 Years?

Maria Michou profile image
Software Developer, mostly back-end, strong advocate for quality code.