I am still a newbie when it comes to git but the more I use it the more I love it. We use SVN at work so the idea of branching in git vs svn are 2 pretty different concepts. As part of the Sneakerhead project I am working on for fun I wanted to be able to keep snapshots of the application. This is a little bit different than a normal workflow where you have things like features and releases. In a tutorial style project I want people to be able to go back and see the application as it was when I was talking about it.
You can accomplish this by branching. If you use the command git branch you can see all of your local branches and if you pass the param -a you can see both local and remote branches.
If you want to create a new local branch that is an exact copy of the current branch that you are on simply run the command.
git checkout -b first-steps
Where first-steps is the name of the branch. The great thing is this runs really fast and contains everything from the branch you are on. It doesn’t actually copy of the entire file system which is why its so fast. Then to push this branch to your remote repo
git push origin first-steps
So follow along on this journey with me here and over at https://github.com/cfaddict/sneakerhead.
I also want to thank a couple of friends for sending me an article on branching. I highly recommend checking this out if you want to get started with branching. It lays out a great strategy on how to develop, creating release and hot fix branches and using the master as the current production version. It is definitely worth the read.