Why GitHub ? GitHub vs SVN
What is GitHub?
Let’s discuss from root why git why not SVN?
1.In short, SVN is a Centralized Revision Control System, and git is a Distributed and decentralized Revision Control System (DVCS)
So let’s understand now what is centralized and distributed decentralized version control
Assume you are in a organization and working in any project then after develop or modify your source code you need to push that changes to repository , check above diagram
If you are using SVN then always you need to check-in/move your code from working copy to SVN central repository , every developer need to point same central repository to commit their changes that’s why SVN is centralized and for that you must have internet connection
If you are using Git then you no need to puss your code to remote repository always , you can work in offline mode that’s why Git provided on features called local repository , once you done changes in your working copy then you can keep safe your changes in Local Repository after verify at single shot you can check-in changes to the remote repository, so here each developer those who are working in same project have their own local repository
So we can consider this is a major difference between Git with Other Version control tool
2. Git is Faster while connecting to remote repository for check-out and check-in where SVN is slow
3. SVN is following two-tree architecture where Git following Three-tree architecture
Now you might thinking what is these architecture let’s understand it now.
Two-Tree Architecture
In two-tree architecture always there is 2 member i.e. Repository and Working copy like below
Here when you need to get source code from Repository to your machine you need to do checkout and once you are done with code changes to keep save them you need to commit those changes so that changes will reflect in your Repository
Three-Tree Architecture
In two-tree architecture always there is 3 member i.e. Repository ,Staging Index and Working copy like below
Here if you mark there is a middle layer called staging index , so once we done with working copy changes you are not directly going to commit them in repository , we are adding bunch of files into staging index once all done then we are moving it to repository
4.Git Becomes slow when it deals with large binary file that change frequently where SVN can able to handle it easily
5.Create branches and merging them is dead easy in Git where in SVN merging branches is bit difficult
Above are common difference between GIT and Other VCS
Now let’s discuss about Git Core
How Git managing Version /Revision ?
Please have a look on below diagram
As per this diagram , we understand in every commit to Repository have different Version like 1,2,3,4,5 so on
Initially one developer pull code from Git to working copy and modified it and push again to Repository so it changed version-------------------1
Again one developer or same developer did the changes and push code to Repository and the version is ------------------------------------2
So this version will keep on change in every commit.
Internally Git generates checksum for every change set where checksum algorithm convert data into a simple number and to generate this checksum git internally used SHA-1 Hash Algorithm
If you will mark properly checksum are hexadecimal with having 40 character (0-9,a-f)
Let’s have look another example
As per above example it clearly indicates the revision of each change
in first case did changes in index.html so it modified once i will commit the checksum will be change
in second case added one more html i.e about.html so new checksum will be created for it
again in third case changed about.html page layout so new checksum will be created for that.
This is How Git is working.
So here we learned what is Git and it’s basic and differentiate Git with Other Version control tool
Good Luck