Book Image

GitLab Quick Start Guide

By : Adam O'Grady
Book Image

GitLab Quick Start Guide

By: Adam O'Grady

Overview of this book

Gitlab is an open source repository management and version control toolkit with an enterprise offering. This book is the ideal guide to GitLab as a version control system (VCS), issue management tool, and a continuous integration platform. The book starts with an introduction to GitLab, a walkthrough of its features, and explores concepts such as version control systems, continuous integration, and continuous deployment. It then takes you through the process of downloading and installing a local copy of the on-premise version of GitLab in Ubuntu and/or CentOS. You will look at some common work?ows associated with GitLab work?ow and learn about project management in GitLab. You will see tools and techniques for migrating your code base from various version control systems such as GitHub and SVN to GitLab. By the end of the book, you will be using Gitlab for repository management, and be able to migrate projects from other VCSs to GitLab.
Table of Contents (10 chapters)

Version control systems and Git

Let's say you write code, or work on a book, or even just want to collect and update a set of text-based documents. You need some method of keeping track of changes, of being able to revert mistakes in the work, or branch in new directions; and you'll probably want some way of remotely backing up your work in case of fire, theft, or acts of a misbehaving computer. This is where version control systems (also known as VCS) come in handy. They save your work at certain points (commits) and can be reverted to earlier states; many VCS offer methods of branching so that you can for example work on a specific feature without interrupting someone else's work on another component. There are many version control systems on the market, but the most prominent in the public eye would be Git. Git is a distributed version control system, which means that it has a full copy of all of the code that exists on each user's computer, and users can pass patches and changes directly between each other rather than entirely relying on a centralized server.

Behind the scenes, git is an advanced program that is lightning fast when it comes to performing operations like staging work, committing changes, or swapping between branches. It's efficient at fetching information from remote repositories to help speed up a user's workflow. Unlike most VCS, git doesn't work by storing the changes that happen to each file. Instead, on every commit, git stores a snapshot of the current state of all files. If a file hasn't changed, rather than storing it again, it simply stores a reference to the last saved version of the file.

When you make a commit, git captures the snapshot and also takes a cryptographic hash a series of complex mathematical operations on the data that produces a unique value and uses the output of that as a reference to the commit, along with some metadata, such as the author. This snapshot sits on top of the rest of the snapshots/commits that you've taken, and in this way you can think of git snapshots as a series of changesets operations that add or remove lines that can be performed on your files to get them to an older or newer state.

We'll cover more on the higher-level use and commands of Git in Chapter 3, GitLab Flow, when we explore the GitLab flow for branching and merging.

GitLab and Git

GitLab is built on top of git so that users who are contributing work (editing code, writing chapters, and so on) to a project will have a copy of the project downloaded/checked out/cloned on their local computer. It provides a web interface for handling many of git's more advanced workflows, and recommends a workflow for interacting with git for the best in productivity, efficiency, and ease of use. We'll cover this workflow in a lot more detail in Chapter 3, GitLab Flow, and in Chapter 4, Issues to Merge Requests, where we'll explore the merging of branches in the GitLab user interface.

By acting as a single source of truth for your developers, GitLab can help you avoid conflicts and the double handling of work while maintaining uptime by relying on the battle-tested GitLab.com platform or your own installation of it, working with tools including geographic replication, disaster recovery, and automated failover.