Brief introduction to git

Git is software for version control. I know what’s software, but version control was a tricky one. Version control software is used by software developers to maintain documentation and configuration files as well as source code. For bigger software projects with multiple contributors, it’s impossible to track progress, activity, development status, bugs, errors, issues, conflicts without version control. Therefore, software for version control is rather a necessity than a luxury. Everyone working with a piece of software (development/maintaining) or aiming to program at some part of their career, (un)fortunately must-know fundamentals of version control.

What is Git?

Main difference between Git and other VCS is how Git stores and thinks about information. Most of the VCS before git used something called delta-based version control which tracked changes in source code files and created chains of changes overtime. It’s possible as shown in:

Illustration of delta-based VCS

Figure 1. Illustration of delta-based VCS

Git doesn’t think of or store its data this way. Git thinks of its data more like a series of snapshots of miniature filesystem. Every time you commit (e.g. save current state of the code) Git basically takes picture of what your files look like and stores a reference to that snapshot. Therefore every change in file as treated as new file. Old files that haven’t changed are not saved again for memory conservation. On next image, we can see different code versions (commits) that share unchanged files in checkins (changes) over time, yet save files that have been changed since last checkin.

Illustration of git VCS

Figure 2. Illustration of git VCS

Basic terms explained:

It’s easier to get started when you understand basic terms and concepts:

  • Repository → contains all of your project’s files and each file’s revision history
  • Fork → personal copy of someone else’s project
  • Clone → creating local copy of the remote repo
  • Pull → fetch and download content from a remote repository and immediately update the local repository to match the content
  • Branch → basically pointer to a snapshot of your changes
  • Commit → save your changes to local repository
  • Push → command that is used to upload local repository content to a remote repository

Resources