How to create a branch in github

So the dev project I’m working on is going two separate paths. My co-worker is looking at more of the ajax/look & feel stuff while I’ll be working on the model (moving to postgresql). We might not bump into each other much, but better safe than sorry. So I’ll need to create a branch of our existing repository.


Here’s how (instructions were varied on the internets):

  1. Get the latest of your code: git pull origin master
  2. Create the branch on your local repo: git checkout -b <branchname>
  3. Make your changes (optional)
  4. Push the branch (creating it on github): git push origin postgresql


If someone else wants to work in your branch or you want to work on it in a different machine, here’s how to do that:

  1. git clone <project path>
  2. cd <project dir>
  3. Now when you do a “git branch -a”, master would show – but should would the other branches. 
  4. To switch to a branch on your local repo, do “git checkout -b <branchName> remotes/origin/<branchName>


One thought on “How to create a branch in github

Add yours

Leave a Reply

Powered by

Up ↑

%d bloggers like this: