Git and GitHub: Introduction

I am a MERN stack developer and student from India. Building and contributing to community.
In the world of software development, collaboration is key. Teams of developers work together to create amazing applications, websites, and programs. But how do they keep track of all the changes, updates, and improvements they make to their projects?
That’s where Git comes into play.
In this blog post, we’ll dive into the world of Git & GitHub, explaining what they are and how they make version control simple and efficient.
What is Git?
Git is a Distributed Version Control System (DVCS) created by Linus Torvalds in 2005. It helps developers manage and track changes to their codebase efficiently.
With Git, multiple developers can collaborate on a project without the risk of:
Overwriting each other’s work
Losing track of changes
Example
Suppose you wrote some code and later made changes. After saving, you realize the next day that those changes broke your entire application. Now you need a way to go back to your previous working code.
This is where Git becomes very useful.
Git:
Keeps track of every change
Lets you go back to older versions
Shows exactly which line was changed and when
What is GitHub?
GitHub is a web-based platform that provides tools and features for developers and teams to collaborate, manage, and host their code repositories.
It is one of the most popular platforms for version control and collaborative software development.
If your project is only on your local machine and you want to:
Share your code online
Show your project to others
Collaborate with teammates
Maintain project history
Then GitHub comes into the picture.
You can upload your project files along with the complete history, and others can contribute or suggest improvements.
In summary:
GitHub combines the power of Git with collaboration and project management features. It is widely used by individuals, teams, and open-source communities.
Key Concepts of Git
Repository
A Git repository (repo) is a directory that contains all project files along with the complete history of changes.
Commit
A commit is like a snapshot of your project at a specific point in time.
Each commit:
Saves your changes
Has a unique ID
Includes a message describing the changes
Branch
A branch is a separate line of development.
Developers use branches to:
Work on new features
Fix bugs
without affecting the main codebase.
Merge
Merging combines changes from one branch into another.
This is commonly used to integrate completed features into the main branch (usually main or master).
Benefits of Using Git
Version Control
Track changes over time and easily roll back to older versions.
Collaboration
Multiple developers can work simultaneously and resolve conflicts efficiently.
Branching
Create separate branches for features or fixes while keeping the main code stable.
Remote Hosting
Platforms like GitHub allow remote hosting, making sharing and collaboration easy.
Open Source
Git is open source, widely adopted, and supported by a large community.
Installation of Git & GitHub
Step 1 – Install Git
Download Git from the official website and install it on your local machine.
Step 2 – Create GitHub Account
Create your GitHub profile using the official GitHub website.
Setup Git on Your Local Machine
After installation, configure Git with your GitHub details.
Set username
git config --global user.name "YOUR_USER_NAME"
Set email
git config --global user.email YOUR_EMAIL_ADDRESS
By default, Git uses master as the branch name when you initialize a repository.
However, GitHub now uses main as the default branch.
Set default branch to main
git config --global init.defaultBranch main
Check configuration
git config --list
Conclusion
That’s it for this blog.
In the next blog, I will list and explain all the important Git commands and their uses.
Follow for more blogs like this and subscribe to my newsletter.
Happy Coding ✌️


