Git

Git

Git is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers who are collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows (thousands of parallel branches running on different computers).

Git was originally authored by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development. Since 2005, Junio Hamano has been the core maintainer. As with most other distributed version control systems, and unlike most client–server systems, every Git directory on every computer is a full-fledged repository with complete history and full version-tracking abilities, independent of network access or a central server. Git is free and open-source software shared under the GPL-2.0-only license.

Since its creation, Git has become the most popular distributed version control system, with nearly 95% of developers reporting it as their primary version control system as of 2022. There are many popular offerings of Git repository services, including GitHub, SourceForge, Bitbucket and GitLab.

See Git on Wikipedia.

Getting started

The Pro Linux Container of Brap is pre-configured with Git. Here are some git commands to get you familiarised with Git:

git init
git add
git commit
git push
git fetch
git merge
git pull
git checkout
git cherry-pick

When starting a project, it is a good practice to use Git to manage its versions. To demonstrate the basics, let's create a new Angular project and use some Git commands to record its versions.

ng new angular-blog

Once the project is created, you can initialize it with Git, and create your first commit:

cd angular-blog
git init
git add .
git commit -m "My first commit"

To list the commits you have made, run:

git log

That's some basics with Git to get you started.

With Git, it is a good-practice to concur to some Git conventions. The Gitflow Workflow, Trunk-based Development, A successful Git branching model and SemVer are good references.

Screenshot of git in VS Code terminal

Screenshot: Git in VS Code terminal

Screenshot of git in VS Code GUI

Screenshot: Git in VS Code GUI

Keywords

  • git
  • version
  • version control system
  • vcs
  • source code

Back to top