In this module, we will learn about
The material in this module has been adapted from:
Jon Loeliger, Matthew McCullough. Version Control with Git, 2nd Edition, 2012, O'Reilly Media, Inc., ISBN 9780596520120.
Scott Chacon, Ben Straub. Pro Git, 2nd Edition, 2014, Apress.
Do you just open an IDE, and start coding? Were do you save your source files?
Also, what would happen if:
To avoid the disastrous situations implied by these questions, version control systems were invented!
Figure from https://git-scm.com/
Figure from https://git-scm.com/
Figure from https://git-scm.com/
Multiple VCS have been developed over the years.
Git overwhelmingly superseded the other systems and became the de facto standard in the software industry.
Here is some data from OpenHub, a public directory of free and open-source software, on the adoption of version control systems.
And here is some data from Google Trends.
Before we get our hands dirty, let's take a whirlwind tour on how Git works.
Traditional VCS systems store data as a list of file-based changes, as in what is called delta-based version control:
Git stores complete versions of each file, as in a stream of snapshots:
Most operations in Git need only local files and resources. For example,
When you clone a Git repository, you get its full history!
Everything in Git is checksummed before it is stored and is then referrenced by that checksum.
It's impossible to alter the contents of a file without Git knowing.
Git uses SHA-1 hash for checksumming, a hashing algorithm that generates 40-character strings composed of hexadecimal characters (0–9 and a–f) and calculated based on the contents of a file or directory structure in Git.
A SHA-1 hash looks something like this:
24b9da6552252987aa493b52f8696cd6d3b00373
When you do actions in Git, nearly all of them only add data to the Git database.
You can lose or mess up changes you haven’t committed yet, but after you commit a snapshot into Git, it is very difficult to lose, especially if you regularly push your database to another repository.
This makes using Git a joy because we know we can experiment without the danger of severely screwing up things.
From this
StackOverflow question.