ArticleslgStudy

computer science

Git

Git is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Git rather than just read about it. In short: Git ( ) is a distributed version control software system that is capable of managing versions of source code or data. It is often used to control source code by programmers who are developing software collaboratively.

Git — main illustration
Git — illustration

Key takeaways

  • Git belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Git to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Git from memory before moving on to harder problems.

Reference excerpt

Git ( ) is a distributed version control software system that is capable of managing versions of source code or data. It is often used to control source code by programmers who are developing software collaboratively. It was originally created by Linus Torvalds for version control in the development of the Linux kernel. Design goals of Git include speed, data integrity, and support for distributed, non-linear workflows—thousands of parallel branches running on different computers. As with most other distributed version control systems, and unlike most client–server systems, Git maintains a local copy of the entire repository, also known as the "repo", with history and version-tracking abilities, independent of network access or a central server. A repository is stored on each computer in a standard directory with additional, hidden files to provide version control capabilities. Git provides features to synchronize changes between repositories that share history; for asynchronous collaboration, this extends to repositories on remote machines. Although all repositories (with the same history) are peers, developers often use a central server to host a repository to hold an integrated copy. Today, Git is the version control system most commonly used by software developers. It is the most popular distributed version control system, with nearly 95% of developers reporting it as their primary version control system as of 2022. It is the most widely used source-code management tool among professional developers. Several different software forges offer Git repository services, including GitHub, SourceForge, Bitbucket and GitLab.

History Torvalds started developing Git in April 2005 after the free license for BitKeeper, the proprietary source-control management (SCM) system used for Linux kernel development since 2002, was revoked for Linux. The copyright holder of BitKeeper, Larry McVoy, claimed that Andrew Tridgell had created SourcePuller by reverse engineering the BitKeeper protocols. The same incident also spurred the creation of Mercurial, another version-control system. Torvalds wanted a distributed system that he could use like BitKeeper, but none of the available free systems met his needs. He cited an example of a source-control management system needing 30 seconds to apply a patch and update all associated metadata, and noted that this would not scale to the needs of Linux kernel development, where synchronizing with fellow maintainers could require 250 such actions at once. For his design criterion, he specified that patching should take no more than three seconds, and added three more goals:

Take the Concurrent Versions System (CVS) as an example of what not to do; if in doubt, make the exact opposite decision. Support a distributed, BitKeeper-like workflow. Include very strong safeguards against corruption, either accidental or malicious. These criteria eliminated every version-control system in use at the time, so immediately after the 2.6.12-rc2 Linux kernel development release, Torvalds set out to write his own. The development of Git began on 3 April 2005. Torvalds announced the project on 6 April and became self-hosting the next day. The first merge of multiple branches took place on 18 April. Torvalds achieved his performance goals; on 29 April, the nascent Git was benchmarked recording patches to the Linux kernel tree at a rate of 6.7 patches per second. On 16 June, Git managed the kernel 2.6.12 release. Torvalds turned over maintenance on 26 July 2005 to Junio Hamano, a major contributor to the project. Hamano was responsible for the 1.0 release on 21 December 2005.

Naming Torvalds quipped about the name git (which is British English slang for an unpleasant or silly person): "I'm an egotistical bastard, and I name all my projects after myself. First 'Linux', now 'git'." The man page describes Git as "the stupid content tracker". The read-me file of the source code elaborates further:

"git" can mean anything, depending on your mood. Random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of "get" may or may not be relevant. Stupid. Contemptible and despicable. Simple. Take your pick from the dictionary of slang. "Global information tracker": you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room. "Goddamn idiotic truckload of sh*t": when it breaks.

The source code for Git refers to the program as "the information manager from hell".

Characteristics

Design Git's design is a synthesis of Torvalds's experience with Linux in maintaining a large distributed development project, along with his intimate knowledge of file-system performance gained from the same project and the urgent need to produce a working system in short order. These influences led to the following implementation choices:

… excerpt ends here. Continue reading the full article.

Illustrations

Git illustration
Git illustration
Git illustration
Git: Some data flows and storage levels in the Git revision control system
Some data flows and storage levels in the Git revision control system
Git: gitg is a graphical front-end using GTK+.
gitg is a graphical front-end using GTK+.

Worked examples

Example 1 — a first encounter with Git

Start with the simplest possible case. Write down what Git claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Git before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Git ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Git

In research
Git appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Git in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Git is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2005 software, Concurrent Versions System, Distributed version control systems, so understanding it makes those chapters shorter.
In everyday life
Look for Git outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Git” →

How to study Git in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Git means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Git out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Git in simple terms?

Git ( ) is a distributed version control software system that is capable of managing versions of source code or data. It is often used to control source code by programmers who are developing software collaboratively.

Why does Git matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Git?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Git.

Tags

  • 2005 software
  • Concurrent Versions System
  • Distributed version control systems
  • Free software programmed in C
  • Free software programmed in Perl
  • Free version control software
  • Git (software)
  • Linus Torvalds
  • Open source projects
  • Self-hosting software
  • Software that uses Tk (software)
  • Software using the GNU General Public License

Keep exploring