kids encyclopedia robot

Git facts for kids

Kids Encyclopedia Facts
Quick facts for kids
Git
Git-logo-2012.svg
Git session.svg
A command-line session showing repository creation, addition of a file, and remote synchronization
Original author(s) Linus Torvalds
Developer(s) Junio Hamano and others
Initial release 7 April 2005; 20 years ago (2005-04-07)
Stable release
2.47.0 Edit this on Wikidata / 7 October 2024
Preview release
Lua error in Module:Wd at line 1575: attempt to index field 'wikibase' (a nil value).
Written in Primarily in C, with GUI and programming scripts written in Shell script, Perl, Tcl and Python
Operating system POSIX (Linux, macOS, Solaris, AIX), Windows
Available in English
Type Version control
License GPL-2.0-only

Git is a special computer program that helps people keep track of changes to files. Think of it like a super-smart notebook for your computer code. It's often used by programmers who work together to build software.

Git helps teams work on the same project without messing up each other's changes. It's designed to be fast, keep your data safe, and let many people work on different parts of a project at the same time.

Linus Torvalds, who also created the Linux kernel, started Git in 2005. He needed a tool that could handle a huge project like Linux.

Unlike some older systems, Git lets every person working on a project have their own full copy of the project's history. This means you can work on your code even without an internet connection. Git also has tools to help you share your changes with others and combine them into the main project.

Git is a free and open-source software. This means anyone can use it, change it, and share it.

Today, Git is the most popular way to manage code changes. Almost all developers use it! Many online services like GitHub, SourceForge, Bitbucket, and GitLab help host Git projects.

How Git Started

Linus Torvalds began creating Git in April 2005. Before that, the Linux kernel project used a different system called BitKeeper. However, the free license for BitKeeper was taken away. This meant the Linux developers needed a new tool.

Linus wanted a system that was:

  • Super fast: He needed to apply changes in just a few seconds.
  • Distributed: Everyone should have their own copy of the project.
  • Safe: It needed strong ways to prevent mistakes or bad changes.

None of the existing free systems were good enough. So, Linus decided to build his own!

He started working on Git on April 3, 2005. Just a few days later, on April 7, Git was already good enough for Linus to use it for his own work. By June 16, 2005, Git was managing the official Linux kernel releases.

Linus handed over the main work on Git to Junio Hamano in July 2005. Hamano released the first major version, Git 1.0, in December 2005.

How Git Works

Git was designed based on Linus Torvalds' experience with the huge Linux project. Here are some key ideas behind it:

Working on Many Ideas at Once

Git makes it easy to create "branches." Think of a branch as a separate path for your code. You can try out new ideas or fix bugs on a branch without affecting the main project. When your idea is ready, you can easily combine your branch back into the main project.

Everyone Has a Copy

Git is a "distributed" system. This means every developer has a full copy of the project's entire history on their own computer. When you make changes, you're working on your local copy. Later, you can share these changes with others.

Works with Other Tools

Git can connect with other systems and use different ways to share code, like over the internet (HTTP, SSH). It can even pretend to be older systems like CVS or Subversion, making it easier for people to switch to Git.

Handles Big Projects Fast

Git is very quick, even with huge projects. It can get the history of changes from your computer much faster than from a remote server.

Keeping History Safe

Git uses special codes (called SHA-1 hashes) to identify every change. This means that once a change is recorded, it's almost impossible to secretly change old versions without anyone noticing. It's like a digital fingerprint for your code's history.

Built with Small Tools

Git is made up of many small programs that work together. This makes it flexible and easy to add new features or combine different parts.

Smart Merging

When different people make changes to the same part of the code, Git tries to combine them automatically. If it can't figure it out, it will tell you so you can fix it yourself.

Cleaning Up

Sometimes, Git creates temporary files or old versions that are no longer needed. Git automatically cleans these up to save space. You can also tell it to clean up manually.

Saving Space

Git stores new changes as separate files. To save space, it can "pack" many changes together into one file. This packing process can take some time, so Git often waits until you're not busy (like at the end of the day) to do it.

What Can Be Tricky

  • Checking one file's history: Because Git tracks whole project "snapshots" instead of individual file changes, looking at the history of just one file can take a little more effort.
  • Renaming files: If you rename a file, Git doesn't explicitly record it as a rename. Instead, it's smart enough to figure out that a file was renamed when you look at the history. This is usually helpful, but sometimes if you rename a file and make lots of changes at the same time, Git might think you deleted the old file and created a new one.

How Git Stores Information

Git stores information in two main ways:

  • An index (or "staging area"): This is like a temporary holding spot for changes you're preparing to save.
  • An object database: This is where Git stores all the actual pieces of your project's history.
Git operations
Some data flows and storage levels in the Git revision control system

The object database holds five types of "objects":

  • A blob: This is the actual content of a file. It doesn't have a name or date, just the file's data.
  • A tree: This is like a folder. It lists file names and points to blobs (for files) or other trees (for subfolders). It's a snapshot of your project's structure.
  • A commit: This is a record of a change. It points to a tree (the project's state at that time), has a timestamp, a message about the change, and points to previous commits.
  • A tag: This is like a sticky note that points to a specific commit. It's often used to mark important points, like a software release.
  • A packfile: This is a compressed bundle of many objects, used to save space and send data efficiently.

Every object in Git gets a unique ID based on its content. This ID is a long string of numbers and letters.

Git also uses "refs" (short for references) to easily find important commits:

  • Heads (branches): These are names for branches that move forward automatically as you add new commits.
  • HEAD: This special reference always points to the branch you are currently working on.
  • Tags: These are like branch references but they stay fixed to a specific commit, often used for releases.

Common Git Commands

Here are some commands you might use when working with Git:

  • git init: This command creates a new Git project in a folder.
  • git clone [URL]: This command makes a copy of an existing Git project from the internet.
  • git add [file]: This command adds a file to the "staging area," preparing it to be saved.
  • git commit -m [commit message]: This command saves the changes from the staging area into the project's history. You also add a short message explaining what you changed.

You can also create a special file called .gitignore. Any files listed in this file will be ignored by Git. This is useful for things like passwords, temporary files, or very large files that you don't want to track.

Git on Different Computers

Git was first built for Linux computers, but it works on many other operating systems too! This includes macOS (Apple computers) and Microsoft Windows.

For Windows, Git often uses special tools to make it feel like a Linux environment. There are also native Windows versions that work directly.

Other versions of Git have been made using different programming languages:

  • JGit is a version written in Java.
  • Go-git is written in Go.
  • Dulwich is written in Python.
  • libgit2 is a basic Git library that other programs can use.
  • JS-Git is a version written in JavaScript.

Git Servers

Because Git is "distributed," you can use any Git project as a "server" to share your code. Git comes with a simple tool called git daemon that lets you share your project over a network.

Many companies and open-source projects use dedicated Git servers to host their code. These servers often add features like:

  • Controlling who can access the code.
  • Showing the code and its history on a website.
  • Managing many different projects.

Free and Open-Source Git Servers

There are many free and open-source options for setting up your own Git server:

  • Gerrit: This server is great for code reviews, where team members check each other's code.
  • Phabricator: Another server that helps manage code, originally from Facebook.
  • RhodeCode Community Edition: Supports Git, Mercurial, and Subversion.
  • Kallithea: Supports Git and Mercurial.
  • Gogs, Gitea, and Forgejo: These are popular, easy-to-use Git servers written in the Go language.

Git Server Services

Instead of setting up your own server, you can use online services that host Git projects for you. The most popular ones are:

  • GitHub
  • SourceForge
  • Bitbucket
  • GitLab

Git with Pictures (GUIs)

Working with Git using text commands can be tricky. That's why many people use "Graphical User Interfaces" (GUIs). These are programs with buttons and menus that make Git easier to use.

GUIs show you your project's history with pictures, like branches, commits, and file changes. They help you do common tasks like saving changes, creating new branches, and combining code. They also have tools to help you fix "merge conflicts" when two people change the same part of a file.

Git comes with its own basic GUI. But many other companies and developers have made their own GUIs, such as:

  • GitHub Desktop
  • SourceTree
  • TortoiseGit
  • GitKraken Desktop

Using a GUI can make learning and using Git much simpler, helping you work faster and make fewer mistakes.

List of Git GUI Clients

Here are some popular GUI clients for Git:

Windows GUIs (Free)

  • GitHub Desktop
  • SourceTree
  • TortoiseGit
  • Git Extensions
  • gitg
  • MeGit
  • GitUI

Mac GUIs (Free)

  • GitHub Desktop
  • SourceTree

Linux GUIs (Free)

  • gitg
  • MeGit
  • GitUI
  • giggle

Other Git GUIs

  • SmartGit (Windows, Linux, Mac)
  • GitKraken Desktop (Windows, Linux, Mac)
  • Glint (Windows, Linux, Mac)

How Many People Use Git?

Git is super popular! Surveys show that it's the most used tool for managing code changes among professional software developers.

For example, in 2022, almost 94% of developers surveyed by Stack Overflow said Git was their main version control system.

Here's how Git compares to other systems over the years:

Name 2015 2017 2018 2022
Git 69.3% 69.2% 87.2% 93.9%
Subversion 36.9% 9.1% 16.1% 5.2%
TFVC 12.2% 7.3% 10.9%
Mercurial 7.9% 1.9% 3.6% 1.1%
CVS 4.2%
Perforce 3.3%
VSS 0.6%
IBM DevOps Code ClearCase 0.4%
Zip file backups 2.0% 7.9%
Raw network sharing 1.7% 7.9%
Other 5.8% 3.0%
None 9.3% 4.8% 4.8% 4.3%

Git Extensions

Many extra tools, called "extensions," have been built to work with Git. These extensions add new features that aren't part of the main Git program. For example, Git LFS helps handle very large files in Git projects. Sometimes, a popular extension might even become part of Git itself later on.

Other open-source Git extensions include:

  • git-annex: Helps synchronize files across different computers using Git.
  • git-flow: Provides a set of rules for how to organize your branches in Git.

Common Ways to Use Git

While Git is flexible, people often follow certain ways of using it:

  • Main Branch: When you start a new Git project, it usually creates a main branch called master (or sometimes main). This branch is often where all the finished changes are combined.
  • No Overwriting History: Once changes are saved and shared, they usually aren't deleted or overwritten. If you need to undo something, you make a new change that reverses the old one. This keeps the history clear.
  • Workflows: Many teams use specific "workflows" or rules for how they use branches. For example, the "git-flow" workflow has special names for branches that are for new features, testing, or fixing urgent problems.
  • Pull Requests: A "pull request" (or "merge request") is a common feature on Git hosting services like GitHub. It's a way to ask someone to review your changes and then add them to another branch. It's like saying, "Hey, I've made some changes on my branch, can you please check them and add them to the main project?"

Keeping Git Secure

Git itself doesn't control who can access your files. It's designed to work with other tools that handle access permissions.

Like any software, Git can sometimes have security issues. For example, in 2014, a problem was found in Git for Windows and macOS. An attacker could create a special, tricky project that, if downloaded and opened, could run harmful commands on your computer. This was quickly fixed in a new version of Git.

Another issue in 2015 allowed attackers to run commands if they could trick someone into cloning a specific web address. This was also fixed.

Git uses a special code called SHA-1 to identify changes. While SHA-1 is generally strong, there have been concerns about its security. Git has been updated to use a stronger version of SHA-1, and there are plans to use even more secure methods in the future.

Trademark

The name "Git" is a registered trademark of the Software Freedom Conservancy. This helps protect the name and ensures its continued use in the open-source community.

See also

Kids robot.svg In Spanish: Git para niños

kids search engine
Git Facts for Kids. Kiddle Encyclopedia.