Git For Beginners: Part 1

Git is a powerful and widely-used version control system that allows you to track changes to your code over time, collaborate with others and manage your codebase more effectively. In this article, we'll go over the basics of Git, including how to install it, check the version, and initialize a repository.

Installing Git

To install Git on your system, you can use your operating system's package manager or download the installer from the official Git website( Here are some examples of how to install Git on different platforms:


If you're using macOS, you can install Git using Homebrew by running the following command in your terminal:

brew install git

Alternatively, you can download the installer from the Git website and run it to install Git.


If you're using a Linux distribution, you can use your package manager to install Git. For example, on Ubuntu or Debian, you can run the following command:

sudo apt-get install git

On Fedora or CentOS, you can use the following command:

sudo dnf install git


If you're using Windows, you can download the installer from the Git website and run it to install Git.

Checking the Version

Once you've installed Git, you can check the version to make sure it's installed correctly. To do this, open a terminal window and run the following command:

git --version

This will display the version of Git that's currently installed on your system.

Initializing a Repository

To start using Git with your codebase, you'll need to create a Git repository. To do this, navigate to the root directory of your codebase in your terminal and run the following command:

git init

This will initialize a new Git repository in the current directory. Git will create a hidden .git directory that contains all the necessary files and metadata for the repository.


There's a lot more to Git than what we've covered here, but these fundamentals should be enough to get you started. By installing Git, checking the version and initializing a repository, you'll be on your way to using Git to manage your codebase with ease. Happy coding!