Tuesday, July 24, 2012

A basic example with Git

In this post, I shall talk about how to create a sample project on Github and start pushing files to your Github account from your machine. You will learn how to create and get started with an example project and start working on a full fledged social project.

  • Create a new repository on Github. In your computer, create a new folder (Eg. C:\Documents\My Projects\Sample)
  • Download and install Git and navigate to the directory in Git console and initialize git – git init
  • Create/add all the project files to the folder and use the command – git add .
  • Enter the command git commit –m “message” and hit enter.
  • Next, enter the command git remote add origin https://github.com/username/repo-name.git where the username is your username and repo-name is the name of the repository you created.
  • Enter git push and your project files are now pushed to the server.

Each time when you make changes to your project and push it to the server, repeat the following steps:

  • git add . 
  • git commit –m “message”
  • git push

That's it! You have learnt the basics of Git and all set to start social coding!

No comments:

Post a Comment