DEV Community

Maria Michou
Maria Michou

Posted on

Checkout a branch by its id

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.


Top comments (0)