Previous Git Blogs
Intialize git repostiory
First Commit
Two tree architecture and Three tree architecture
Best basic practices for writing commit messages
Viewing the commit logs
Git Basic WorkFlow
In the last Blog Git Basic WorkFlow we have moved changes from our working directory, to our staging index, and to the repository. And I have gave those changes simple labels A and B.
Actually Git usses different concept to track these changes or say snapshots of changes.
In a typical Git workflow, A would represent changes to 2 files or 3 filse and B would represent one new files that were added to the repository.
So How Git Track
When we submit changes to the repository, at that point Git generates a checksum for each changed set. A checksum is a number that is generated by taking data and feeding it into an
algorithm, checksum algorithm converts data into a simple number
-
The same data put into the algorithm always equals the same checksum coming
-
out that's important because if we change the data going in we get a different checksum out.
-
So one of the most common uses for checksums in computers is to make sure
-
that the data didn't change, if the data changed well then the checksum will be different.
-
And this data integrity is fundamentally built into Git that's very different
Git generates this checksum is by using the SHA-1 hash algorithm.
-
The number that the algorithm generates is always going to be a 40 character hexadecimal string (0 -9 and a - f)
where we can see this number
naveen@naveen:/var/www/html/RND/symfony_sites/symfony_todoapp$ git log -n 1
commit a67edfaa870430ae58dd6d6e8cea68f0c9a08c0a
Author: Naveen
Date: Mon Dec 14 13:44:18 2015 +0530
my initial commit
The commit ID is the SHA-1 number that will be unique to the changes that are in this commit. Git attaches the a bit meta information to each one of those snapshots, SO that git can trace the information.
Thanks
0 Comment(s)