Tools
Tools: Git for Beginners: Tracking Changes, Push and Pull Explained
2026-01-18
0 views
admin
Git and GitHub ## Introduction ## What Is GitHub? ## What Is Git? ## How to Create a GitHub Account ## Step-by-step: ## What Is Git (the Software)? ## How to Download and Install Git ## On Windows ## On macOS (MacBook) ## Option 1: Using the Installer ## Option 2: Using Terminal ## On Linux ## How to Connect Git to Your GitHub Account ## Step 1: Set Your Name ## Step 2: Set Your Email ## Understanding a Repository ## What Is a Repository? ## Local vs Remote Repository ## Creating Your First Repository ## Step 1: Open Git Bash / Terminal ## Step 2: Initialize Git ## What Actually Happened? ## Checking Repository Status: ## Adding a File to the Repository ## How Git Tracks Changes ## The Working Directory ## Why Git Doesn’t Auto-Save ## Checking Changes with git status ## The Staging Area ## Why git add Exists ## How Git knows what changed ## Checking the Staging Area ## Why the Staging Area Is Important ## Commits — Saving Your Work in Git ## What Is a Commit? ## Why Commits Matter ## How to Create Your First Commit ## Writing Meaningful Commit Messages ## Tips for beginners: ## Checking Your Commit ## Push and Pull — Syncing with GitHub ## Local vs Remote Repository ## What Is Push? ## What Is Pull? ## Safe Workflow Habits If you are new to programming, data analysis, or tech in general, Git and GitHub can feel confusing at first.
People throw around terms like repository, commit, push, and pull often without explaining what they actually mean. This article is written for absolute beginners, including: People with no technical background People who have never used Git before People who just want a simple, clear explanation In this first part, we will focus only on: GitHub is a cloud based platform that allows developers to store, manage, and collaborate on code using a version control system called Git. In simple terms GitHub is a website where people store and share code online. Think of GitHub like: With GitHub, you can: Even if you are working alone, GitHub is useful because it keeps your work safe. Git is a distributed version control system (VCS) used to track changes in source code during software development. Git is a tool that runs on your computer. Imagine writing a document and being able to say: “Take me back to how this looked yesterday.” That’s what Git does but for code and files. Creating a GitHub account is free and easy. You now have a GitHub account. Before we install it, one important clarification: GitHub → a website
Git → a program you install on your computer Installing Git allows your computer to: After installing, you will have Git Bash, a terminal used to run Git commands. Open Terminal and type: If Git is not installed, macOS will prompt you to install it. Open a terminal and run: For Ubuntu / Debian:
sudo apt install git For Fedora:
sudo dnf install git After installation, confirm:
git version To connect Git on your computer to GitHub online, Git needs to know who you are. Use the same email you used for GitHub
This does not upload anything yet. It only tells Git: "This work belongs to me." A repository (or repo) is a centralized location where project files and resources are stored. Repositories typically exist in the cloud, allowing for collaboration, version control and remote access to code modules and software packages. In simple terms:
A repository (repo) is a project folder that Git is tracking. When a folder becomes a repository: A repository contains: Note: If a folder does not have a .git folder, Git is not tracking it. There are two types of repositories you’ll work with: Navigate to the folder where you want your project. Create a new project folder: To tell Git to start tracking this folder, run: You will see something like: Congratulations, this folder is now a Git repository When you ran git init, Git: Create a simple file e.g: "Git sees the file, but is not tracking it yet."
This is where change tracking begins. We have created a repository and saw that Git can “see” files.
Now we will answer an important question: How does Git know what changed, and what to save?
Git does this using two main areas: Understanding these two will make Git feel logical instead of confusing. The working directory is simply: Your project folder as you normally use it. Note: Git does not auto-save your work. “Why doesn’t Git just save changes automatically?” Because Git is designed to: You control when a version is created. To see what Git knows about your project, run: "This file changed, but it is not ready to be saved yet." Git is watching, but waiting for instructions The staging area is where you tell Git: “These are the changes I want to save.”
_ It acts as a preparation zone between editing and saving. Nothing is saved permanently yet. To move changes from the working directory to the staging area, you use: Or to add everything: "I want these changes included in the next save." It then records only the differences, not the entire file. After running git add, check again: Now you will see something like: "These changes are staged and ready to be saved" Staging allows you to: Now it’s time to save a snapshot of your work*, this is called a **commit. Think of it as telling Git: “This is a version I’m happy with — save it.”
_ Commits are important because they let you: A repository (git init done) Added files to the staging area (git add) You create a commit like this: Commit messages are important because they tell you and others what changed. After committing, run: In the previous parts, we have learned: Now it’s time to share your work online and keep it up-to-date. This is where push and pull come in. Before we talk commands, let’s review: Push and pull are simply the communication between local and remote Push sends your committed changes from your local repository to GitHub. “I’ve made changes on my computer. Save them online.”
_ Pull fetches changes from GitHub (remote) to your local repository. “Check online for new updates and bring them to my computer.”
_ Even if you’re working alone, following safe habits is important. Here’s how a typical session looks: Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse COMMAND_BLOCK:
git --version Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git --version COMMAND_BLOCK:
git --version COMMAND_BLOCK:
git config --global user.name "Your Name" Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git config --global user.name "Your Name" COMMAND_BLOCK:
git config --global user.name "Your Name" COMMAND_BLOCK:
git config --global user.email "[email protected]" Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git config --global user.email "[email protected]" COMMAND_BLOCK:
git config --global user.email "[email protected]" CODE_BLOCK:
cd Documents Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
cd Documents CODE_BLOCK:
cd Documents CODE_BLOCK:
mkdir my-first repo
cd my-first-repo Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
mkdir my-first repo
cd my-first-repo CODE_BLOCK:
mkdir my-first repo
cd my-first-repo COMMAND_BLOCK:
git init Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Initialize empty Git repository Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Initialize empty Git repository CODE_BLOCK:
Initialize empty Git repository COMMAND_BLOCK:
git status Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
No commits yet Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
No commits yet CODE_BLOCK:
No commits yet CODE_BLOCK:
touch index.html Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
touch index.html CODE_BLOCK:
touch index.html COMMAND_BLOCK:
git status Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Untracked files: index.html Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Untracked files: index.html CODE_BLOCK:
Untracked files: index.html COMMAND_BLOCK:
git status Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
modified: index.html Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
modified: index.html CODE_BLOCK:
modified: index.html COMMAND_BLOCK:
git add index.html Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git add index.html COMMAND_BLOCK:
git add index.html COMMAND_BLOCK:
git add Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git status Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Changes to be committed: index.html Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Changes to be committed: index.html CODE_BLOCK:
Changes to be committed: index.html COMMAND_BLOCK:
git commit -m "Add initial project files" Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git commit -m "Add initial project files" COMMAND_BLOCK:
git commit -m "Add initial project files" COMMAND_BLOCK:
git commit -m "stuff" Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git commit -m "stuff" COMMAND_BLOCK:
git commit -m "stuff" COMMAND_BLOCK:
git commit -m "Add styling to navigation bar" Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git commit -m "Add styling to navigation bar" COMMAND_BLOCK:
git commit -m "Add styling to navigation bar" COMMAND_BLOCK:
git log Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
commit 9fceb02
Author: Your Name <[email protected]>
Date: Sat Jan 18 16:00 2026 Add initial project files Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
commit 9fceb02
Author: Your Name <[email protected]>
Date: Sat Jan 18 16:00 2026 Add initial project files CODE_BLOCK:
commit 9fceb02
Author: Your Name <[email protected]>
Date: Sat Jan 18 16:00 2026 Add initial project files COMMAND_BLOCK:
git push origin main Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git push origin main COMMAND_BLOCK:
git push origin main COMMAND_BLOCK:
git pull origin main Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git pull origin main COMMAND_BLOCK:
git pull origin main COMMAND_BLOCK:
git pull Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git add
git commit -m "Describe changes" Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
git add
git commit -m "Describe changes" COMMAND_BLOCK:
git add
git commit -m "Describe changes" COMMAND_BLOCK:
git push Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
# Start your work
git pull # Make changes to your files
# Stage and commit changes
git add .
git commit -m "Add feature or fix bug" # Save your work online
git push Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
# Start your work
git pull # Make changes to your files
# Stage and commit changes
git add .
git commit -m "Add feature or fix bug" # Save your work online
git push COMMAND_BLOCK:
# Start your work
git pull # Make changes to your files
# Stage and commit changes
git add .
git commit -m "Add feature or fix bug" # Save your work online
git push - What GitHub is
- What Git is and why we need it
- Creating a GitHub account
- Installing Git on Windows, macOS, and Linux
- Connecting Git to your GitHub account - Google Drive, but for code
- Dropbox, but for projects
- A backup location for your work - Save your projects online
- Access them from any computer
- Share your work with others
- Collaborate with teammates - Track changes in your files
- Save different versions of your work
- Go back to an earlier version if something breaks - Go to https://github.com
- Click Sign up - Email address - Verify your email
- Complete the setup steps - Track changes
- Communicate with GitHub - Go to https://git-scm.com
- Click Download for Windows
- Open the downloaded file
- Click Next on most screens (default options are fine)
- Finish installation - Go to https://git-scm.com
- Download Git for macOS
- Open the installer and follow the steps - Git starts watching files inside it
- Git can track changes over time
- Git can save versions of your work - Your project files (code, text, images)
- A hidden folder called .git (Git’s brain) - Local Repository - Lives on your computer
- Where you write and edit code
- Created using the terminal - Remote Repository - Lives online (GitHub)
- Used for backup and collaboration - The folder exists
- Git is not tracking it yet - Created a hidden .git folder
- Started tracking this directory
- Prepared to record changes
You normally never touch the .git folder manually. - Confirms you are inside a repository
- Shows tracked and untracked files
At this stage it may say: - The working directory
- The staging area - Delete or rename files - You open index.html
- You change some text
- You save the file - The file is changed
- Git notices the change
- But Git has not saved it yet - Let you decide what to save
- Let you group related changes together
- Avoid saving broken or unfinished work - Selecting files before uploading
- Choosing photos before posting
- Packing items before traveling - The last saved version
- The current version of your files - Very accurate - You couldn’t choose what to save
- Every small change would be forced into history
- Commits would become messy - Group related changes
- Keep history clean
- Commit with confidence - Git tracks your project in the working directory
- You move changes to the staging area using git add - A photo of your project at a point in time
- A save point in a video game
- A version checkpoint of your code - Git stores the current state of files in the staging area
- You can later go back to this point if needed - Undo mistakes – go back to a previous commit if something breaks
- Track progress – see what changed over time
- Collaborate safely – others can see your work without overwriting yours
- Keep history organized – clean, meaningful snapshots make debugging easier - Your history is lost
- You can’t roll back changes
- Collaboration becomes dangerous - git commit - tells Git to save the snapshot
- -m - allows you to add a message describing the changes
- "Add initial project files" - the commit message (explained below) - Use the present tense: "Fix bug in login form"
- Be short but descriptive: "Add homepage layout"
- Focus on what changed, not how: "Update README" vs "Type some text" - Git saved your snapshot
- You now have a recorded version of your project - Creating a repository
- Tracking changes
- Saving work with commits - git push - sends changes
- origin - the remote repository (GitHub)
- main - the branch you are pushing to (usually main) - Your work is safe online
- Others can see your changes
- You have a backup in case your computer fails - Your local project is up-to-date
- You avoid conflicts with other people’s changes
- You can continue working safely - Always pull before starting work - Ensures you have the latest version - Stage and commit your changes regularly - Push after completing a task - Saves work online - Write meaningful commit messages - Helps you and others understand the history - Avoid working directly on GitHub - edit locally - commit - push - then view online
how-totutorialguidedev.toaimllinuxubuntudebianbashgitgithub