Page tree
Skip to end of metadata
Go to start of metadata

What is Git?

Git is a free, mature and actively maintained open source project originally developed in 2005 by Linus Torvalds, the famous creator of the Linux operating system kernel, designed to handle everything from small to very large projects with speed and efficiency. A staggering number of software projects rely on Git for version control, including commercial projects as well as open source. Developers who have worked with Git are well represented in the pool of available software development talent and it works well on a wide range of operating systems and IDEs (Integrated Development Environments). 


                  



Commonly used features scenario

The following is an example of the type of scenario in which a feature branching workflow is used.


Janne begins a new feature

Before she starts developing a feature, Janne needs an isolated branch to work on. She can request a new branch with the following command:

This checks out a branch called jannes-feature based on master,and the -b flag tells Git to create the branch if it doesn’t already exist. On this branch, Janne edits, stages, and commits changes in the usual fashion, building up her feature with as many commits as necessary:

Janne has a break

janne adds a few commits to her feature over the course of the morning. Before she leaves for lunch, it’s a good idea to push her feature branch up to the central repository. This serves as a convenient backup, but if Janne was collaborating with other developers, this would also give them access to her initial commits.

This command pushes jannes-feature to the central repository (origin), and the -u flag adds it as a remote tracking branch. After setting up the tracking branch, Janne can call git push without any parameters to push her feature.


Janne finishes her feature

When Janne gets back from lunch, she completes her feature. Before merging it into master, she needs to file a pull request letting the rest of the team know she's done. But first, she should make sure the central repository has her most recent commits:

Then, she files the pull request in her Git GUI asking to merge jannes-feature into master, and team members will be notified automatically. The great thing about pull requests is that they show comments right next to their related commits, so it's easy to ask questions about specific changesets.


Jack receives the pull request

Jack gets the pull request and takes a look at jannes-feature. He decides he wants to make a few changes before integrating it into the official project, and he and Janne have some back-and-forth via the pull request.


Janne makes the changes

To make the changes, Janne uses the exact same process as she did to create the first iteration of her feature. She edits, stages, commits, and pushes updates to the central repository. All her activity shows up in the pull request, and Jack can still make comments along the way.

If he wanted, Jack could pull jannes-feature into his local repository and work on it on his own. Any commits he added would also show up in the pull request.

Janne publishes her feature

Once Jack is ready to accept the pull request, someone needs to merge the feature into the stable project (this can be done by either Jack or Janne):


This process often results in a merge commit. Some developers like this because it’s like a symbolic joining of the feature with the rest of the code base. But, if you’re partial to a linear history, it’s possible to rebase the feature onto the tip of master before executing the merge, resulting in a fast-forward merge.

Some GUI’s will automate the pull request acceptance process by running all of these commands just by clicking an “Accept” button. If yours doesn’t, it should at least be able to automatically close the pull request when the feature branch gets merged into master.

Meanwhile, John is doing the exact same thing

While Mary and Jack are working on jannes-feature and discussing it in her pull request, John is doing the exact same thing with his own feature branch. By isolating features into separate branches, everybody can work independently, yet it’s still trivial to share changes with other developers when necessary.



Common commands

git
 init - Initializing a new repository
	clone - Cloning an existing repository 
         commit - Saving changes to the repository
               pull - Will download all the changes from the point where the local and master diverged
                   push -  Push commits made on your local branch to a remote repository
                       add - Add file contents to the index
                          



What is Gitlab?

GitLab is a web-based DevOps life cycle tool that provides a Git-repository manager providing wiki, issue-tracking and CI/CD pipeline features.
GitLab started as an open source project to help teams collaborate on software development. By delivering new functionality at an industry-leading pace, GitLab now provides a single application for the entire software development and operations life cycle. It also provides everything you need to Manage, Plan, Create, Verify, Package, Release, Configure, Monitor, and Secure your applications.


Features

Manage

Gain visibility and insight into how your business is performing. GitLab helps teams manage and optimize their software delivery life-cycle with metrics and value stream insight in order to streamline and increase their delivery velocity.

Plan

Regardless of your process, GitLab provides powerful planning tools to keep everyone synchronized. GitLab enables portfolio planning and management through epics, groups (programs) and milestones to organize and track progress. Regardless of your methodology from Waterfall to DevOps, GitLab’s simple and flexible approach to planning meets the needs of small teams to large enterprises. GitLab helps teams organize, plan, align and track project work to ensure teams are working on the right things at the right time and maintain end to end visibility and trace-ability of issues throughout the delivery life-cycle from idea to production.

Create

Create, view, and manage code and project data through powerful branching tools.

GitLab helps teams design, develop and securely manage code and project data from a single distributed version control system to enable rapid iteration and delivery of business value. GitLab repositories provide a scalable, single source of truth for collaborating on projects and code which enables teams to be productive without disrupting their workflows.

Verify

Keep strict quality standards for production code with automatic testing and reporting.

GitLab helps delivery teams fully embrace continuous integration to automate the builds, integration and verification of their code. GitLab’s industry leading CI capabilities enables automated testing, Static Analysis Security Testing, Dynamic Analysis Security testing and code quality analysis to provide fast feedback to developers and testers about the quality of their code. With pipelines that enable concurrent testing and parallel execution, teams quickly get insight about every commit, allowing them to deliver higher quality code faster.


Package

Create a consistent and dependable software supply chain with built-in universal package management. GitLab enables teams to package their applications and dependencies, manage containers, and build artifacts with ease. 

Secure

Security capabilities, integrated into your development life-cycle.

Release

GitLab's integrated CD solution allows you to ship code with zero-touch, be it on one or one thousand servers. GitLab helps automate the release and delivery of applications, shortening the delivery lifecycle, streamlining manual processes, and accelerating team velocity. 

Configure

Configure your applications and infrastructure. GitLab helps teams to configure and manage their application environments.

Monitor

Automatically monitor metrics so you know how any change in code impacts your production environment.

You need feedback on what the effect of your release is in order to do release management. Get monitoring built-in, see the code change right next to the impact that it has so you can respond quicker and effectively. No need to babysit deployment to manually get feedback. Automatically detect buggy code and prevent it from affecting the majority of your users.

Defend

Defend your apps and infrastructure from security intrusions. GitLab provides runtime application security, threat detection and management, data security, and application infrastructure security.