Skip to main content

Git

Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/git

In short

Git is a free, open-source distributed version control system that tracks changes to files over time, so developers can collaborate and undo mistakes.

What is Git?

Git keeps a complete history of a project by recording snapshots of its files, called commits. At any point you can see what changed, who changed it, and why, and you can return to an earlier version if something breaks. Linus Torvalds created Git in 2005 to manage development of the Linux kernel, and it is now the most widely used version control system in the world.

Git is distributed, which means every developer has a full copy of the repository, including its entire history, on their own machine. Most work, like committing, viewing history, and creating branches, happens locally and even works offline. Developers share changes by pushing to and pulling from a remote repository, often hosted on a platform such as GitHub, GitLab, or Bitbucket.

A save system in a video game is a common analogy for Git. Each commit is a save point you can reload, and branches let you try a risky path without losing your main progress. The typical workflow is to edit files, stage (select) the changes you want to keep with git add, and save them as a commit with git commit.

Git is often confused with GitHub. Git is the version control tool itself, which runs on your computer, while GitHub is an online service that hosts Git repositories and adds collaboration features like pull requests and issue tracking.

At a glance

Git's four places: git add moves changes from the working directory to the staging area, git commit saves them in the local repository, git push uploads them to a remote repository, and git pull brings other people's commits back.your computerserverWorking directoryfiles you editStaging areathe next commitLocal repositoryfull historyRemote repositoryGitHub, GitLabgit addgit commitgit pushgit pull
Committing saves a snapshot on your own machine. Nothing is shared until you push.

Key takeaways

  • Git is a distributed version control system: every clone contains the full history.
  • Changes are saved as commits, which act as restorable snapshots.
  • Branches let you work on features in isolation and merge them later.
  • Git is the tool; GitHub, GitLab, and Bitbucket are services that host Git repositories.

Example

A basic Git workflowbash
# Start tracking a project
git init

# Stage changes and save a snapshot
git add .
git commit -m "Add homepage layout"

# Connect to a remote repository and upload your work
git remote add origin https://github.com/example/my-project.git
git push -u origin main

# See the project history
git log --oneline

Readers ask

What is the difference between Git and GitHub?

Git is the version control software that tracks changes on your computer. GitHub is a website and service that hosts Git repositories online and adds collaboration features such as pull requests, code review, and issues.

What is a Git repository?

A repository, or repo, is a project folder tracked by Git, including all of its files and its complete history of commits. Git stores this history in a hidden .git directory inside the project.

Is Git free to use?

Yes. Git is free and open-source software released under the GNU General Public License version 2, and it runs on Windows, macOS, and Linux.

Often compared

See also

Sources

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings