Getting started with Git

Getting started with Git
Git is a distributed version control system that enables developers to track code changes, collaborate in teams, and manage project history. In Git, you can store different file versions, access them when needed, and work together on a project with no risk of data loss.
Git streamlines complex project work, delivers transparency of changes, and helps avoid teamwork conflicts.
In this tutorial, we will explore the main commands for using Git without the GUI.
Getting started
Install Git:
Download Git from the
.
Run the installation file and follow the setup wizard's prompts.
During the installation, select to integrate with the command line or PowerShell.
Working with repositories
Initializing a repository (git init)
Initialization allows Git to index files and start tracking changes in a directory.
Create a directory for your project by running this command in the terminal:
mkdir <path_to_directory>If you need to initialize a repository in an existing directory, skip this step.
Navigate to the project directory:
cd <path_to_directory>To initialize the repository, run this command:
git init
Command | Use case |
|---|---|
git log | Viewing history. |
git blame <file_name> | Viewing changes in a specific file. This command shows who made the changes and in which lines. |
| Viewing changes within a given line range in the selected file. |
git branch | Viewing all repository branches. The current branch will be marked with |