Git HOWTO Start a new project based on an other project

Written by on Apr 4 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.

Meet
Steven

Hi I'm Steven,

I wrote the article you're reading... I lead the developers, write music, used to race motorcycles, and help clients find the right features to build on their product.

Get Blog Updates