Git, upload your project

In my last post, I make a simple project in php, just a simple hello world. That was not for the advance users, but this one will be.Now I will upload this project to github.

A distributed revision control system (DRCS), distributed version control or decentralized version control (DVCS) keeps track of software revisions and allows many developers to work on a given project without necessarily being connected to a common network. Distributed revision control (DRCS) takes a peer-to-peer approach, as opposed to the client-server approach of centralized systems. Rather than a single, central repository on which clients synchronize, each peer’s working copy of the codebase is a bona-fide repository. Distributed revision control conducts synchronization by exchanging patches (change-sets) from peer to peer. This results in some important differences from a centralized system:

  • No canonical, reference copy of the codebase exists by default; only working copies.
  • Common operations (such as commits, viewing history, and reverting changes) are fast, because there is no need to communicate with a central server.

Rather, communication is only necessary when pushing or pulling changes to or from other peers.

  • Each working copy effectively functions as a remote backup of the codebase and of its change-history, providing natural protection against data loss.

Other differences are as follows:

  • There may be many “central” repositories.
  • Code from disparate repositories are merged based on a web of trust, i.e., historical merit or quality of changes.
  • Numerous different development models are possible, such as development / release branches or a Commander / Lieutenant model, allowing for efficient delegation of topical developments in very large projects.
  • Lieutenants are project members who have the power to dynamically decide which branches to merge.
  • Network is not involved in most operations.
  • A separate set of “sync” operations are available for committing or receiving changes with remote repositories.

DVCS proponents point to several advantages of distributed version control systems over the traditional centralised model:

  • Allows users to work productively even when not connected to a network
  • Makes most operations much faster since no network is involved
  • Allows participation in projects without requiring permissions from project authorities, and thus arguably better fosters culture of meritocracy instead of requiring “committer” status
  • Allows private work, so users can use their revision control system even for early drafts they do not want to publish
  • Avoids relying on a single physical machine as a single point of failure.
  • Still permits centralized control of the “release version” of the project
  • For FLOSS software projects, it becomes much easier to create a project fork from a project that is stalled because of leadership conflicts or design disagreements.[1]

Git is a distributed revision control system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development. Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Git’s current software maintenance is overseen by Junio Hamano. Git is free software distributed under the terms of the GNU General Public License version 2. [2]

But what is github? Github is a web site where you can host your projects and control it with git. You can host unlimited public projects free or you can host private projects by subscribing (sorry, that is not free!)

The web site for github is :- https://github.com/ . create an account to let know the world you are a developer!

To know more about github:- https://github.com/about

Enough talk, lets get back to work.

I am not going to show you how to setup git, cause this tutorial is good for it, here is the link:- http://help.github.com/win-set-up-git/ . don’t forget to generate ssh keys. (ssh???? Well I will get it back to you. J )

Well, I hope you did what the above link said to you J . now time to create a new repo!

I am suppose to give tutorial on php. And I made a folder named tutorials. Let rename it with “php_tutorials”. Now in the github website (https://github.com/) look for “new repository”, click on it.

Fig : the create repository button in showing in this page. Click on that page.

Give the project name “php_tutorials”. Give some descriptions, if you have a home page of your project, (I do not have for mine ) so give it in here.

Now you are seeing a page right? Great, now we are going to do what this page is saying.

First, configure your user name and email. Type on the command prompt (or terminal if you are a linux guy J )

git config –global user.name “your_user_name”

git config –global user.email your_email

 

now you have to make git init. Now go to your folder “php_tutorials”. Not by your file browser, but with your command prompt. (better if you use git bush. I hope you already know it. J)

after going in the folder, (I hope it is the folder “php_tutorials”), type the command:-

git init

so you will create an empty git repository in the folder “php_tutorials”

Fig: this will happen after git init

So we already have tutorial1 folder(from my last post). Now it is time for pushing (don’t make any other sense J )

First you have to add, so type

git add *.*

Now we have to commit. Write in the terminal (remember terminal==command prompt == git bush J )

git commit –m ‘tutorial 1 commit’

so you will see the following screen:-

Well, I hope you know you have to do a git add. Let’s do it then! Write the following code:

git remote add origin git@github.com:your_user_name/php_tutorials.git

 

if you make your repo name something else , place that something else J instead of php_tutorials , but don’t forget the .git J

now the fast time, the push J type the line:-

well this is the most tedious way of git. You can use git gui but it is not as powerful as git command line tool.

If you done all of the above so go to your repo page in github, check that it is ok, then go to sleep, cause I am going to sleep. K

 

 

References:

[1] distributed revision control Wikipedia page
http://en.wikipedia.org/wiki/Distributed_revision_control

[2] git Wikipedia page http://en.wikipedia.org/wiki/Git_%28software%29

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s