A complete GIT commands and lession
-___-___--__-_-__
-___-___--__-_-__
-___-___--__-_-__
Theory
-___-___--__-_-__
GIT is a Distributed Version Control System.
Distributed Version Control System :-
***Suppose 4 different people working on four different places with four different devices.
***After working , work of each person will be store in a local repository.
***Then work from local repository will by store to a remote repository.
***Advantage is : If remote repository is down , data can be store in local repository .
GIT : Is a version control system which helps store and ,anage versions.
Github : is a Remote repository which can be used as central repository.
jekins : Continuous integration loop , automatically pull the code and test it and again push the code automatically.
GIT is :
1.Distributed
Compatible
non-linear
branching
lightweight
speed
opensource
reliable
secure(sh1)
economical (Under GPL's Lisence)
There are two types of repository :
1.Central
2.Local
-___-___--__-_-__
LAB:
-___-___--__-_-__
-___-___--__-_-__
1.Installing GIT
-___-___--__-_-__
1. First download the GIT from git-scm.com--> Download.
Then install it as per following screen shot.
-___-___--__-_-__
*** Getting Started with GIT Commands
-___-___--__-_-__
> $ git --version
Shows the version of the git software installed
>$ mkdir bcode
Creating a local folder or project folder
>If git is installed in c , location will be
c --> users --> Your user name (Sandeep)-->bcode (fodername)
>Now folder is created which is empty for now.
$ cd bcode
//Lets go inside the newly created folder using cd command
Now in the folder bcode we have to create two html files which will be our code to upload to github repository in future.We can use any editer like sublime editer, visual studio code or note pad ++ , to create html files and codes easily.
The html codes are like :
1.bgcode.html
2.page1.html
>Two html pages created inside our location folder i.e. bcode.
Now we can run those html codes for check.Its properly created or not.
//Now we have to initialize git inside our folder
//In cmd we are already inside bcode folder by using cd command previously.
//now we run the command to initialize git
$ git init
Now we will jump to the next line where a new tag (master) is being added.Master means the master branch.
Now when we observe the location bcode in file manager there is a .git folder created.
Now can check the files inside the git folder.
> Actually we have to create a staging area before track any file.e.g. let we have 1000 files in the work station.We need to track the changes in two files only and to update those two in github. That two file will be in staging area ,changes to which will be pushed to Remote Repository (git hub).
>Files from workstation will be pushed store in staging are which will be pushed to local repository after changes.Then from local repository it will be pushed to remote repository.
***Changes will not be tracked unless until we add the codes into staging area
>add command is used to add a file into staging area.
$ git add bgcode.html
>Now I made some changes in the file and will see changes are being noticed or not.
>As we have added bgcode.html to staging area , now whatever changes we will do in bgcode.html ,it will be tracked.
If we want see what changes have made ,we have to use the command "diff".
>$ git diff
#github
#git
#gitRepository
#githublearning
#learnGIT
#learnGITHUB
#technocart
#SandeepMishra
Comments
Post a Comment