GitHub for Beginners — From Scratch

If you’ve ever worked on a project and found yourself juggling multiple versions of the same file — like resume_old.docx
, resume_final_final.docx
, and so on — then Git can be your lifesaver. Git is the most popular Version Control System in the world. It helps you track changes in your files over time, work collaboratively with others, and easily go back to previous versions when needed.
This guide will take you through Git basics, installation, configuration, and your very first commands.
What is Git and Version Control?
Version Control is like a history book for your files. It remembers every change you make and allows you to revisit or restore any version at any time.
Git is the tool that manages this history.
With Git, you don’t need dozens of file copies. One file is enough — Git will remember every edit you’ve made.
Key Git Concepts to Know
Working Directory: Your current workspace where you make changes.
Staging Area (Index): A draft zone where you prepare changes before saving them to history.
Local Repository: The project’s complete history stored on your computer.
Remote Repository: A version of your project hosted online (e.g., GitHub) for collaboration.
Branch: A parallel version of your project to work on features without disturbing the main code.
Pull Request: A proposal to merge changes from one branch into another.
Merge: Combining changes from different branches into one.
Installing Git
On Windows:
Download Git from git-scm.com.
Run the installer, keep default settings, and set the default branch name to
main
.Verify installation:
git
Configuring Git
Tell Git who you are so it can credit your work:
git config --global user.name "Your Name" git config --global user.email "you@example.com" git config --list
Creating Your First Git Project
Make a new folder on your computer for your project.
Open that folder in your code editor (like VS Code).
Enable Git tracking in the folder — this makes it a Git repository.
Adding Code and Working With It
Create a file in your project folder (for example,
hello.md
) and write something inside it, like a short introduction.Tell Git to track the file — this is called staging.
Save the file into Git’s history — this is called committing. Each commit is like a snapshot of your project at a certain moment in time.
Making Changes
Open your file and edit the content.
Save your changes.
Stage and commit again to save this new version in Git’s history.
You can also add new files (like a JavaScript or HTML file), write your code inside them, and commit those changes as well.
Seeing What’s Happened
Git can show you a list of all the changes you’ve made over time.
You can open old versions of your files or undo mistakes by returning to a previous commit.
Sharing Your Project on GitHub
Once you’re happy with your local work:
Go to GitHub and create a new repository.
Link your project folder to this GitHub repository.
Upload (push) your commits so they appear online.
Now your project is safe in the cloud and ready for collaboration with others.
You Just Learned How To:
Understand Git’s purpose and main concepts
Set up Git on your computer
Create and track files
Edit, save, and manage versions of your code
Share your work on GitHub
With these basics, you can now explore branching, pull requests, and merging — the real superpowers of Git and GitHub.
Subscribe to my newsletter
Read articles from Gayatri G. directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
