Skip to main content
All technologies
Git logo

What is Git?

Git is an open source version control system that records every change made to a codebase.

Version control. Updated by DATAL Projects

Made by
Linus Torvalds, maintained by Junio Hamano
First released
2005
License
GPL version 2
Written in
Mainly C
Type
Distributed version control system
Official site
git-scm.com

What Git is

Git is an open source version control system that records every change made to a codebase. Any change can be reviewed or undone, and several developers can work on the same project safely.

Linus Torvalds, the creator of Linux, wrote Git in 2005. The Linux kernel team had been using a commercial tool called BitKeeper, and lost free access to it. Torvalds wanted a replacement that was fast, worked without a central server and protected the history from damage.

A few months later he handed day to day maintenance to Junio Hamano, who has led the project since. Git spread beyond Linux as hosting sites such as GitHub appeared from 2008 onward. It is now the standard version control system for software projects of all sizes.

How Git works

Git tracks a folder of files called a repository. When you reach a point worth saving, you choose which changes to include, which is called staging, and then make a commit. A commit is a snapshot of the project with a message, an author and a unique ID. The chain of commits is the project history, and you can go back to any of them.

A branch is a separate line of work. You can create a branch to build a feature or fix a bug without touching the main branch, then merge it back when it is ready. If two people changed the same lines, Git reports a merge conflict and asks you to choose the right version.

Git is distributed, which means every copy of a repository contains the full history. You clone a repository from a remote, such as one hosted on GitHub, work and commit offline, then push your commits to the remote and pull the commits that others made. A pull request is a feature of hosting sites, built on top of Git branches.

Key features of Git

  • Complete history

    Every commit records what changed, who changed it and why. You can compare versions or restore an older one at any time.

  • Cheap branching

    Creating and switching branches takes almost no time or space. This encourages trying ideas safely and keeping work separate.

  • Distributed design

    Each clone is a full copy of the repository. You can commit, view history and branch with no network connection.

  • Staging area

    You pick exactly which changes go into the next commit. This keeps commits small and focused.

  • Data integrity

    Every commit is identified by a hash of its contents. Damage or tampering in the history is detected.

  • Speed

    Most operations run locally and finish almost instantly, even on large projects with long histories.

When to use Git

A good choice for

  • Source code for any kind of software project
  • Teams where several people change the same codebase
  • Solo projects that need a safe undo and a record of changes
  • Text-based files such as documentation, configuration and scripts
  • Automated deployment that starts from a push

Pick something else when

  • Large binary files such as video, big art assets or datasets, unless you add Git LFS
  • Files that people edit together live, where a shared document tool works better
  • Use as a general backup system for a whole computer

Git compared with alternatives

Git vs GitHub

Git is the tool and GitHub is a hosting service for Git repositories. Git works fully on your own machine. GitHub adds an online copy, pull requests, issues and automation.

Git vs Subversion

Subversion, or SVN, is an older system that keeps the history on one central server. Git gives every user the full history and makes branching and merging much easier. Subversion is still found in some long-running projects and handles large binary files in a simpler way.

Git vs Mercurial

Mercurial was also created in 2005 and is a distributed system with similar ideas. Many people find its commands more consistent. Git won far wider adoption, so it has more hosting options, tools and tutorials.

How to start learning Git

  1. 01Install Git from git-scm.com and run git --version to check it.
  2. 02Set your name and email with git config, then run git init in a practice folder.
  3. 03Learn the daily loop: git status, git add, git commit and git log.
  4. 04Practice creating a branch, merging it and resolving a small merge conflict on purpose.
  5. 05Read the free Pro Git book on the official site and push a practice repository to a remote such as GitHub.

What Git costs

Git is free and open source under the GNU General Public License version 2. There are no fees for personal or commercial use. Hosting services that store your repositories online have their own free and paid plans.

How DATAL Projects uses Git

Git is part of our software development work in the Philippines. Common uses:

  • Version history for every project
  • Branches for new features
  • Safe rollbacks

Common questions about Git

What is Git used for?

Git is used to track changes to files, mainly source code. It lets you see the history of a project, undo mistakes and work with other people without overwriting their changes.

Is Git free?

Yes. Git is open source software and free for everyone, including companies.

Is Git hard to learn?

The basic commands for saving and sharing work can be learned in a day or two. Advanced topics such as rebasing and fixing a tangled history take longer, but beginners rarely need them at first.

Git vs GitHub: which should I use?

They are not rivals, and most developers use both. Git manages versions on your computer, and GitHub stores a shared copy online and adds team features.

Is Git still worth learning?

Yes. Nearly every software team uses Git, and it is expected knowledge for most developer jobs. It is also useful for solo work.

Need a project built with Git?

Tell us what you need. We reply with a scope, a price, and a timeline.

Start a Project