Introduction to Git and Github

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

Source: Dev.to

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
  • Multiple developers can work on the same project safely

How to Track Changes Using Git

Step 1: Initialize Git

git init

This tells Git to start tracking the project.

Step 2: Check File Status

git status

Shows which files have changed.

Step 3: Add Files to Staging

git add .

The . adds all changed files.

Step 4: Commit Changes

git commit -m "Describe what you changed"

A commit is like saving a checkpoint in a game—you can always return to it later.

How to Push Code to GitHub

Step 1: Create a Repository on GitHub

  1. Go to GitHub.
  2. Create a new repository.
  3. Copy the repository URL.

Step 2: Connect Your Project to GitHub

git remote add origin 

Step 3: Push Your Code

git push -u origin main

Your code is now stored on GitHub and accessible online.

How to Pull Code from GitHub

Pulling downloads the latest code from GitHub to your computer.

git pull origin main

Useful when:

  • You are working on multiple computers.
  • Other developers have made changes to the project.

Summary

  • Git tracks changes in your files.
  • Version control helps you manage and recover your code.
  • GitHub stores your projects online.
  • Push uploads your code to GitHub.
  • Pull downloads updates from GitHub.
  • Commits save your progress step by step.
Back to Blog

Related posts

Read more »

A Beginner's Guide to Git and GitHub

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 vers...

Getting started with GitHub

Setting up Git locally - Configure Git to connect to your remote account. For Linux/macOS users, run the commands in a terminal; Windows users can use Git Bash...