Sneakerhead Git Branches

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.

http://nvie.com/posts/a-successful-git-branching-model/

Hi, I’m Dan Vega. I am a Software Engineer living just outside of one of my favorite places in the world, Cleveland Ohio. I am a self-taught programmer who firmly believes that you can accomplish anything in this life if you put your mind to it, roll up your sleeves and are willing to put in the work.

I have been writing software for over 17+ years now and I use my knowledge, passion, and influence to help other developers achieve their goals. I teach online and currently, have over 22,000 students.

When I am not writing software I have a number of things that really keep me busy. I love to read books, listen to podcasts and watch online courses. I have a real thirst for knowledge and it consumes me every single day of the week. I also love to run & lift heavy weights which keep me balanced throughout the week.

Please note: I reserve the right to delete comments that are offensive or off-topic.

  • Normally you would work on a feature and then merge back to develop but the way that I am creating these snapshots I think I am going to go a different route. I will work on the develop branch and when I get to a stopping point and just write a new branch. Thoughts?

  • Hey Dan, something that you might find helpful with git is this little snippit of code: https://gist.github.com/bittersweetryan/6259201. Add it to your .bash_profile and it’ll show your git branch in the prompt.

  • Thank you Ryan, nice feature to have!

  • The successful branching model you referenced can be used even if here is only one developer on a project. There’s no problem sending pull requests through github to yourself. Treat the pull request as if someone else sent it….