Git is a distributed version control system created by Linus Torvalds in 2005 for managing the Linux kernel source. After BitKeeper, the previous free-for-kernel tool, withdrew its free license, Torvalds wrote git in two weeks as a replacement. Within a few years it had become the dominant VCS in software, displacing Subversion, CVS, and Mercurial.
"Distributed" means that every working copy is a full repository with complete history; no central server is fundamentally required. Commits, branches, and merges happen locally; pushing and pulling synchronises with remotes when you choose. This model made git exceptionally well suited to open-source collaboration and gave rise to GitHub, GitLab, and Gitea as hosting platforms.
Core concepts include:
- Commit: a snapshot of the repository at a point in time
- Branch: a movable pointer to a commit; creating one is cheap
- Remote: another repository you push to or pull from
- HEAD: the current commit/branch
- Working tree: the files in your filesystem
- Index (staging area): changes queued for the next commit
Git's power comes with complexity. Commands like rebase, cherry-pick, and reflog give precise control but can also destroy work if used carelessly. A healthy respect for git reflog as the last-resort recovery tool is a mark of an experienced git user.
Video
Related terms: Git Commit, Git Branch, Git Repository, github
Discussed in:
- Chapter 16: Version Control with Git · How Git Thinks
Also defined in: Textbook of Linux
