Git and github → Architecture and commands

3 min readMar 10, 2023
git and github are two different things

— — — — — — — -Introduction of git — — — — —

First of all git and github are two different thing github is a service which provide repository or folder for your code and git is a software configuration or source code management tool or to manage the different versions of your code

source code management tools are of two types →

1.Centrilised version control System (CVCS)
2.Distributed version control System (DVCS)

problems with CVCS :-

1.There is no copy of code available

2.if repository being down than all collapsed

3. as there is no copy of code available and you need an internet connection all the time you try to connect to repository

4.since everything is centralised if control server gets failed you will lose your data

Git is used to overcome all these problems .Git is a dvcs tool which means the code written by you is in distributed form or there is a local repo is present in your device where you commit your code before push it on github which means if your github or central repository being down your code is available to work now your code is distributed or more copy of your code is available.

Architecture of Git -:

Three parts of git folder →

1.Working directory — — it is a part where all your code is present

2.Staging area — — it is that part where you can add file or code from working directory that is need to be commited or add to local repository

3. Local repository — — here you can add your final code which you can upload on central server or github

Before working — —

1.first of all we need to install git using “ apt install git” command in linux you can also use it in windows

2.Next you will make a folder where you are working with git

3. now run git init command to initilize a folder as git folder

4. the folder is now divided in 3 parts run ls -a for check

Commands to push your code on github from local System →

  1. make a folder →mkdir git
  2. git init →to initialize git personal directory
  3. git -version
  4. git config — global “your name”
  5. git config — global “your email”
  6. git status →now you are present in working directory make a file or add it to staging area using the command below →
  7. git add .
  8. git commit -m “ your message” (to add your code in local repo)
  9. git log →give info who is commit the code
  10. git show <commit id> →information about the commit
  11. git remote add origin <git repo url> →where the code is uploaded
  12. git push -u origin master →then you need to enter your github id and password to push the code on particular repo
  13. git pull -u origin master →first you need to give the url of that repo by above command




Cloud computing and DevOps Engineer and to be as a fresher I am learning and gaining experiance by doing some hands on projects on DevOps and in AWS OR GCP