Github



Git is really in use nowadays, and most of the companies are using it for smooth development and proper file synchronizations.

So, here is a small tutorial on using GITHUB from command line.


Create a account on github. And set your username and email on the terminal using the following git commands


  • git config --global user.name "your_name"
  • git config --global user.email "your_name@mail_domain.com"


1. Open a repository locally

$ git clone https://github.com/your_username/repository_name


Now, in Git work flow, your local repository consist of 3 stages.

a. Your Working Directory - This holds the actual files

b. Index - This is like a staging area.

c. Head - This points to the last commit you have made.


2. Suppose you create a new File, called modules.txt
So, to add this file to the server, you first have to add it to the index .

$ git add modules.txt

or 

$ git add *


3. But, to actually commit these changes

$ git commit -m "Some updating message"

This command basically moves your changes to one step ahead towards the HEAD.
But, still your changes are not yet saved to the server.


4. The process called PUSHING is responsible for saving to the server.

$ git push origin master

So, here,
origin = the local directory 
master = server repository. 

Master can be replaced by any other branch.

After this you will see something like 

Counting Objects...
Delta compression...
Writing Objects...
Total...
To https//.....


Summary

a) git Clone
b) git add
c) git commit
d) git push origin master







0 comments:

Post a Comment