This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Setup Your Project


Install git, create a project, add a file to the project and commit it.

In this step, we will set up the project for our new website.   It is generally a best practice to develop a website with a source control management (SCM) system.  For Heroku, the hosting provider we are using, it is a requirement.  So we'll install some SCM software if we don't have it already, create a new project, add a file to that project and then commit it to the project.

1) Install git

"git" is a free, open source SCM that we will use to version control our project.  Available for Windows, Mac and Linux, git is very popular and becoming widely adopted in the web development community.  

You can download and install here.

2) Create a project

Creating our project is as simple as creating a new folder on our computer.  This folder can live anywhere you want to keep your web work.  If you have any doubt where to put the folder, go ahead and create it on your desktop.

3) Initialize git

Open a terminal window and navigate to the folder you just created.  Once inside, initialize the project by typing:

git init

4) Create new file

Now that we have an empty repository to work with, we'll create a new file to add to the project.  It is customary to include a README file in all your programming project - canonically accepted helper documentation to which the next developer who works on your project can refer.  In this case, we'll create a new text file using the editor of our choice and call it README.md.

Inside the new file, we'll add a little text for people to learn something about our project.

Hello World with Python
==========================

This is my first website using Python.  I hope you like it.

Credits
--------------------------
* Author: [your name here!]
* Peer: [list your favorite peers from P2PU]


5) Add and commit file to project

Once we have a README file for our project, we need to tell git about it so it can track all its versions.  To do this, we use our terminal window again and type the following command:

git add README.md

After we tell git that we want the file to be version controlled, we need to "commit" it to the project.  A commit tells git that you are finished working with the file - that this version is complete.  Again, we use our terminal window and type the following command:

git commit -a -m "Added a README file"

6) Show Your Stuff

Now it's time to share your work with your peers!  In order to do this, we need to share our commit log with the group.  The commit log is a list of the versions of the files you've made so far.  This will show if we completed the task correctly.

Yet again, we go to our terminal window and use a git command:

git log

Copy/paste the product of the command, and post in a comment to the task.  Note - git log will include your email address.  If you would prefer not to share with the group, go ahead and delete the line it is on.

Task Discussion


  • gushan said:

    git log

    commit bea9731ee9de15b49611270b51569bdca5f1da76
    Author: Agus Hanapi
    Date:   Wed May 4 08:46:36 2016 +0700

        Added a README file
     

    on May 3, 2016, 10:05 p.m.
  • Vivek said:

    commit 791001a52d3cf5f82165e266c7756a23f09731b8
    Author: Vivek <newton2304@gmail.com>
    Date:   Sun Apr 12 23:13:31 2015 +0530
     

    on April 12, 2015, 1:47 p.m.
  • FrankT said:


    commit 8d087f94bdca8b92e8cb0b90ab64eaf3ad75689b
    Author: Tachyon5 <franctaylor.ft@gmail.com>
    Date:   Fri Apr 4 13:59:33 2014 -0700

        Added a README file

    on April 4, 2014, 5:01 p.m.
  • Gebers said:

    commit b472fdb764f424aea3be27b8c83fce5d552aa0ce
    Author: eric <************@gmail.com>
    Date:   Sat Feb 28 16:46:02 2014 -0700
    on March 1, 2014, 12:26 p.m.
  • neecetinsley said:

    C:\CurrentRiverRats>git log
    commit cbacfa1a5bf6e70bd3bd6c4c091d1903e0827949
    Author: Denise Tinsley <dtinsley91@gmail.com>
    Date:   Wed Dec 25 12:26:51 2013 -0600
     
        Added a ReadME file
    on Dec. 25, 2013, 1:28 p.m.
  • IF said:

     

    commit 2f2d60a0bebfc3f314f0ce6b782cdee1977103e8
    Author: Ryan Terry <nefertem@gator3136.hostgator.com>
    Date:   Fri Dec 13 10:26:53 2013 -0600
     
        Added a README file
    on Dec. 13, 2013, 11:57 a.m.
  • Fer said:

    commit f549bdc1c5ad8ef25278a40537ae05c501362f84
    Author: fer <fer@debian>
    Date:   Thu Nov 14 11:11:36 2013 +0000

        Added a README file
     

    on Nov. 14, 2013, 5:14 a.m.
  • joepep said:

     

    ommit 0f89c413f7426f22549ffd397a8f8cce7d31f08d
    Author: Joepep
    Date:   Mon Jun 10 12:49:20 2013 +0000
     
        Added a README file
    on June 10, 2013, 8:52 a.m.
  • Wouter van den Bos said:

    This is the output

     

     

    commit 10248c3a290d25c4a598e6cee09b911225ac47db
    Author: Wouter van den Bos <woutervdbos@Wouter-van-den-Boss-MacBook-Pro.local>
    Date:   Thu Feb 21 23:56:29 2013 -0800
     
        Added a README file
     
     
    no email adress here.. previously got this message
     
    Your name and email address were configured automatically based
    on your username and hostname. Please check that they are accurate.
    You can suppress this message by setting them explicitly:
     
        git config --global user.name "Your Name"
        git config --global user.email you@example.com
     
    After doing this, you may fix the identity used for this commit with:
     
        git commit --amend --reset-author
     
    I got into VIM but didn't see the email adress there...??

     

    on Feb. 22, 2013, 3:04 a.m.
  • saravanan said:

    commit 91a49c5b241ba476bfede059c02754cf88399583
    Author: magi
    Date:   Mon Aug 6 11:12:47 2012 +0530

        Added a README file
     

    on Aug. 6, 2012, 1:59 a.m.