What is Git?
Git is an open source tool that is used for version control of software. It was created in 2005 by Linus Torvalds. The word "Git" comes from the British colloquial language and translates as "git". Linus Torvalds justified his choice of name for Git on the one hand because the word was practical and still unused in the software world and on the other hand because he names all his products after himself.
Git allows multiple developers to work on a project by having a local working copy of the entire repository (and therefore the project data) on their computer. Git makes it possible for developers to track changes to the code, undo them, make them available to others and also obtain changes from others via Git. In addition to the developers' local working copies, there are also remote repositories. The changes from your own repository can be made public via Git by "pushing" them to a remote repository. Because every developer has a copy of the complete project data, Git is a distributed version control system.
What is a version control system?
A version control system like Git is used in software development to store and manage changes to the source code. There are three types of version control systems: local version control, centralized version control and distributed version control. With local version control, files are simply copied locally to a separate directory. With central version control, there is a central server that manages all versioned files and enables people to retrieve files from this central repository (storage location) and transfer them to their PC. With distributed version management, there is a central repository, but each person has a copy of the repository and therefore the complete project data. Version management can be controlled with commands such as "git commit" (see below).
What are the advantages of Git?
- Data security: As every developer has a copy of all project data via Git, the probability of losing data due to a server failure is minimal.
- Flexibility : Several developers can work on a project at the same time thanks to Git.
- Version storage: As every code change is tracked and saved via Git, older versions of the project can be accessed at a later date in an emergency. This prevents work that has been done from being overwritten or lost. The "git commit" command also plays a role here (see below).
Git terms
- Repository: A Git repository (storage location) is a working copy of the developers that contains the complete history of all changes. There is also a remote repository in which all local changes are collected.
- Branch: Thanks to Git, development statuses (e.g. new features) can be divided into so-called branches (separate working branches). They are used to develop different functions separately from each other.
- Commit: The "git commit" command is used to record the status of a project. This means that the current status of a project is saved as a version in Git. "Git commit" is therefore a particularly relevant function.
- Merge: The "git merge" command is used to merge changes from different branches.
- Push : The "git push" command is used to send local changes to a remote repository.
GitHub
In addition to Git, the version control system that is used via the command line, there is also GitHub. In contrast to Git, GitHub is not a version control system but a hosting platform that enables version control and collaboration on projects. GitHub is characterized by its user-friendliness, as the user interface simplifies the administration of Git repositories. GitHub is particularly popular for sharing open source software, as public repositories can be used on GitHub.
GitLab
As an alternative to GitHub and the Git version control system, there is also GitLab. Like GitHub, it serves as a repository manager. However, GitLab can be self-hosted and therefore allows complete control over your own data. GitLab is primarily used by teams who want to manage and execute project tasks, as it includes an issue tracking system and a system for continuous integration and continuous delivery (CI/CD).
Conclusion: "Git", "GitHub" and "GitLab" are interrelated terms, but a precise distinction must be made in detail between the functions and possible uses.
Further information:
https://git-scm.com/book/de/v2/Erste-Schritte-Was-ist-Git?
https://www.ionos.de/digitalguide/websites/web-entwicklung/git-tutorial/
Video: