Computersnyou

Git Structure and your first git repository part 2 [ creating repositories ]

Posted on  1/1/2013

This is second chapter of git crash course . in this chapter we will cover about git structure and how to create git repository . we will look at internal folder structure of git .

Git Structure 

git structure is based on three tree structure where 1 : is git repository 2: is staging 3 : working copy of your codes ,

In this structure we create a repository add some files on them and then after initialising the repository  in working copy we make changes in our codes then we add those modified files to staging index then finally we commit it on our repository

Git Structure
Git Structure
Git Structure

3 : Working :  first we create some files and code sets , they consider as our working copy   |    Git Initialize
2 : Staging Index : then we add them in our staging index    | Git Add somefile.txt
1 : finally we commit it in our repository  |  Git commit

Creating first repository :

at this point i am assuming that your have working git installation and little bit knowledge of version control and git structure

Steps to create first git repository

  1. open terminal or cmd in windows
  2. change directory to the folder that contains your codes
  3. [bash]
$git init  
[/bash]
  1. Above command will create local git repository
[bash]$git add . [/bash]
  1. above command will add all files in staging index
  2. [bash]$ git commit -m ” Initial Commit ” [/bash]
  3. above command will commit those files to repository with the  ” -m  ”  message that this is ” initial commit ” you can change message according your personal preference but make that identical so when you look at log you can easily identify what was that


  • Home
  • About