A Beginner's Guide to Git and GitHub

Published: (January 17, 2026 at 01:56 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

If you have ever saved a file as final_project.py, then final_project_v2.py, and eventually final_project_v3.py, you have experienced the manual version of version control. It’s messy, confusing, and prone to errors. In this article we’ll show how using Git and GitHub lets you manage your code professionally.

Benefits of Using Git and GitHub

  • Collaboration – Multiple people can work on the same project without overwriting each other’s code.
  • Undo mistakes – Revert to a previous version if your code breaks.
  • Experimentation – Create a branch to try out a new feature without interfering with the main project.

Tracking Changes Using Git

Step A: Initialize your project

git init

Step B: The Staging Area

Add a specific file:

git add filename.py

Add everything:

git add .

Step C: Commit the changes

git commit -m "Add login functionality"

Pushing Code to GitHub

  1. Create a repository – Go to GitHub, click New Repository, give it a name, and click Create.

  2. Link your local Git to GitHub – Copy the URL of your new repo and run:

    git remote add origin https://github.com/your-username/your-repo-name.git
  3. Push your code:

    git push -u origin main

Pulling Code from GitHub

When working in a team or from a different computer, pull the latest changes from GitHub to your local machine:

git pull origin main

Version control might feel like extra work, but it’s the ultimate safety net for developers.

Back to Blog

Related posts

Read more »

Introduction to Gitbash and Github

Definitions - Git is a widely used, free, and open‑source system designed to handle projects of all sizes. It enables developers to track changes in code and f...

Introduction to Git and Github

Why version control is important - Every change is recorded - You can go back to older versions of your code - You can see who made a change and when - Multipl...