Announcing:

LessMoney Conference will be June 7th in Tampa! Register today and make us smile super big!

Git HOWTO Start a new project based on an other project

written by Steven on April 04, 2008

In my previous article we talked about how to use git and github. In this article we'll talk about how to make a project that is based on another project.

The scenario: There is an existing open source project that you would like to use as the starting point for your new killer web 2.1 website. You are the bomb. I'm going to use one of my existing open source projects so you can all play along at home. h2.

Note:

  • If you haven't read the previous article, please go do so now.
  • This assumes that you are using github. (I still have some invites, so if you'd like one, just send me a note).
  • You are using git 1.5.4 or greater on your local machine. (git --version)

Here we go:

  • Go to github and create a new repo.
    • Make sure you follow the instructions, doing the local git init through the git push origin master.
    • You now have a fresh repo for you new fancy almost funded web 2.2 website. You are the man.
  • git remote add stevenbristol git://github.com/stevenbristol/lovd-by-less.git
    • Now you have two remotes. One to your origin and one to the lovd-by-less master.
  • it pull stevenbristol master
    • this gets the lovd-by-less source and puts it into your local directory.
  • git push
    • This will push your changes to your master.
    • What!? I didn't commit anything, what's going on here? When you did the remote pull, the files are automatically comited.
  • git fetch stevenbristol
    • Git magic is happening right now.
  • git branch stevenbristol stevenbristol/master
    • This creates a tracking branch.
  • git branch
    • See all of your branches.
  • git remote
    • See all of your remotes.
  • git checkout stevenbristol
  • git pull
    • Nothing to pull because there have been no changes since the previous pull (step 3).
    • Notice that we didn't have to specify which remote to pull from, as we would have if this had been a normal branch created with git branch -b.
  • git checkout master
    • Back to your master.
    • Now you can git (sic) to work building your ultimate about to be tech crunched web 2.3 website. Everyone is jealous of you. And you love it.

Thanks to Josh Owens who keeps answering my git questions and made this post possible.

Learn how LessEverything built their consultancy to over $1,000,000 annual revenue at LessMoney Conference, June 7th in Tampa Florida. Each attendee will get early access to our upcoming ebook as well.

Leave a Comment

About Steven
Steven Bristol has written code for the past 20 years. He like green vegetables and kittens, oh and butterflies too. He loves to throw ninja stars at his enemies.

You Should...

Follow Steven on Twitter
Friend Steven on Facebook
Subscribe
LessEverything Copyright 2011 LessEverything.com
We don't like footers, they're kinda boring