Getting started with git
21 January, 2019
This post will help you quickly understand the why and how of git. So, if you didn't familiarize with git yet, now is the right time to catch the train.
This article is suited for developers or project manager who begin with git. But some of the resources will help you to... teach git !
Why git ?
Git provides a way of versioning source code. It is the most employed version control system used today. It is used to track changes on very simple projects (like this article) as well a complex systems with a lot of variants (e.g. the Linux Kernel).
Record change... and go back in time
Think of git as your parachute...or a time machine. It records changes in software, text or source code each time you modify something. You can easily compare what you did with a previous state of things.... and revert your changes if you are not happy with the result.
Simplify collaboration
You can use git to propose and share modifications with your team. It helps you create alternative versions of an existing project. You can notify your team members to review the change together and decide if you want to integrate it.
Git also simplifies collaboration between developers and other stakeholders. It offers a clear picture of what version of code is running (or being tested) at any point in time. When a bug is recorded or need for an evolution arise, git provide an easy way to link it to a state of the code repository.
This is not new idea, but git overtook the historical tools like SVN or CVS because it is much faster to use. Git makes branching, merging and integrating changes so quick and easy. A couple of week after you start using it it will likely become a essential tool. And you will be asking yourself how you did this before git.
Git for CI/CD
With the advent of hosted services like Gitlab and Github, git also becomes central in project management. It gives you backups and user access management for free and also a practical UI to review code. Enterprises deploy private versions of theses services for their internal use.
It becomes a important component of Continuous Integration or Continuous Delivery toolchains.
How to get started ?
Get hands on
Git is easy to learn. Within an hour or two you will be familiar with the usage.
- Atlassian offers very good git tutorials. Well organized, easy to read, and covers both the why (use case) and how-to of using git. You may want or not to explore Bitbucket (an atlassian product similar to github or gilab) but all other material is relevant and independent from the editor.
- Katakoda offers several online tutorial. It will make you familiar with git command line. Short scenarios (10 mn), nothing to install, all happens inside a web browser.
- Another good online tutorial is learngitbranching.js.org
Branching
Creates branches to represent features under development or product releases. This allows to easily share ownership of code as a team.
It will help you to contribute to an existing project or set up a CI/CD system.
Share the knowledge
- how to teach git. If you are involved in teaching git to other people, take the time to review this very good article from Rachel Carmera that provides insights on the best angle to explain git.
- The following discussion on HN is also worth reading: https://news.ycombinator.com/item?id=18919599
- http://eagain.net/articles/git-for-computer-scientists/. Not really to teach git (except maybe to computer scientists) but will help you get the theory behind the tool.