Let’s face it, everyone that loves technology, web development or any IT-related stuff works in teams, the old concept of a programmer/developer alone in his basement is not part of our life anymore, so; the usage of a version control system is a must. As you probably know, I am big fan of what I consider the best VCS, of course, I am talking about: Git (Is there something else?).
What I really enjoy is working in a customized terminal like iTerm + Fish Shell, that couple is simply awesome! But… sometimes using remotes, branches, workflows can be a litter intimidating, like today: one of my colleagues asked me the simplest way to get a copy (checkout) of any remote branch from a git repository, so, here is my answer:
# 1) We get the latest references git fetch origin # 2) Display all the branches, just to be sure we have the one we are interested in git branch -v -a # 3) Download (checkout) the branch git checkout -b LOCAL_BRANCH_NAME REMOTE/REMOTE_BRANCH_NAME # 3.1) Real example of this command: git checkout -b develop origin/develop
That’s it for today, enjoy and be happy with your repo 🙂