Towards AI

The leading AI community and content platform focused on making AI accessible to all. Check out our new course platform: https://academy.towardsai.net/courses/beginner-to-advanced-llm-dev

Follow publication

Complete Git Tutorial for Beginners with Examples

Muttineni Sai Rohith
Towards AI
Published in
7 min readDec 24, 2022

--

Git is a version control system that lets us track the changes we make to our files over time. With Git we can revert to various states of our files. We can make a copy of our files and make changes to that copy and then merge these changes to the original copy.
We can install git using this official website.

Photo by Luke Chesser on Unsplash

Configuring git:
To verify git installation, we can open git bash and type the git — version command. This shows the latest version of git installed on our PC.

git --version

The first thing we have to do is to set our username and email address. Git uses this information to identify who made changes to specific files. To set our username and email id, we can use the below commands -

git config --global user.name “Our_username”
git config --global user.email “Our_email”

This will configure our Git environment. To check whether the configuration is succeeded, we can still check our configuration in the local machine using this command —

git config -l

We can also store credentials in the cache, Just to avoid giving them each time using the below command -

git config --global credential.helper cache

Cloning existing git repo to local -
We can clone the existing git repo into the local machine using the command -

git clone https://ourrepo

Creating and Initializing a new project in Git
Create a new folder or navigate to the folder where you want to create your first project. I have used git bash to create a folder test_calculator using the below commands —

mkdir test_calculator
cd test_calculator

Alternatively, you can Open the folder you like through File Explorer, Right click on it and select Git Bash Here

Output

Now once the folder is ready, we need to initialize the project, For this, we need to run the git init command. This will tell git to start watching our files, for…

--

--

Published in Towards AI

The leading AI community and content platform focused on making AI accessible to all. Check out our new course platform: https://academy.towardsai.net/courses/beginner-to-advanced-llm-dev

Written by Muttineni Sai Rohith

Senior Data Engineer with experience in Python, Pyspark and SQL! Reach me at sairohith.muttineni@gmail.com

No responses yet

Write a response