Fetching Remote Branches in Local

Was working on a project and needed to fetch a branch from remote repository to do some changes. I knew the branch existed on remote, but was feeling lazy to go to github and check out the name.

So, I did what any developer would do, spend an hour to find another way to do it, instead of spending a few seconds to just look it up from the repository.

Learnt a new command to list all the remote branches locally. 1

git branch -r

This Git command will show you remote branches. The -r flag here is short for --remotes.

Footnotes

  1. https://www.freecodecamp.org/news/git-list-remote-branches/