Saturday, 4 August 2012

How to use Git?

Here are the STEP BY STEP instructions to use git to save your project into the local repository

To start with you should configure your git by command:
$git config --global user.name "your name"
Then you should configure your email address by which you have made GitHub account
$git config --global user.email "your_email@email.com" 
Initialize your git repository by using command:
$git init
these commands has to be entered by parsing on to your directory where your project is residing.

Next you have to add your file using:
$git add filename
Now your status is staged, your file not yet committed. You can add more file  by using same command recursively.

Now you can commit by:
$git commit -m 'revision version'
you can change your previous commit by using:(optional)
$git commit --amend
This command takes your staging area and uses it for the commit.
After commit you should add your remote repository for which you have made an account by using:
$ git add repositoryname [url]

 you can copy/paste url from your Github.com repository.

Finally to push your commited files   type:
$git push reponame url
Your account will be updated.
..........................................Thank you....................................................

No comments:

Post a Comment