Git and GitHub for Beginners: Complete Guide with Commands
Git is a free version control tool that tracks every change you make to your code on your local machine. GitHub is a cloud platform where you store and share those Git repositories online. Together, they let developers collaborate, revert mistakes, and manage projects. Over 93% of professional developers worldwide use Git as their primary version control system.
- Git is local; GitHub is remote. They are different things that work together.
- About 93.9% of developers use Git as their version control system, according to the Stack Overflow Developer Survey 2023.
- You only need roughly 10 commands to handle 90% of real-world Git work.
- Your GitHub profile is increasingly treated as a live portfolio by recruiters, especially at Indian product companies like Razorpay, Zepto, and CRED.
- Open-source contribution starts with a single pull request, and this guide walks you through it step by step.
What Is Version Control and Why Does It Matter?
Version control is a system that records every change you make to a file over time so you can recall specific versions later. Think of it like Google Docs revision history, but built for code and far more powerful.
Without version control, teams email zip files, overwrite each other’s work, and lose hours debugging changes nobody can trace. That is not hypothetical. It is how most college projects still run. Version control explained simply: it is the difference between “I broke something and I don’t know what” and “I broke something, here is the exact line, and I will revert it in 10 seconds.”
Why Git Won
Git was created by Linus Torvalds in 2005 to manage Linux kernel development. It is distributed, meaning every developer has a full copy of the project history on their own machine. No internet is required to commit, branch, or review history.
According to the Stack Overflow Developer Survey 2023, 93.9% of professional developers use Git. No other version control system is even close. SVN, the old enterprise standard, sits at under 5%.
Git vs GitHub: The Difference That Confuses Everyone
Git is software you install on your computer. GitHub is a cloud platform owned by Microsoft that hosts Git repositories online. You can use Git without GitHub entirely. You cannot use GitHub without Git.
A useful analogy: Git is Microsoft Word, GitHub is Google Drive. One is the tool, the other is where you store and share the output. GitLab is a direct GitHub competitor worth knowing about. It is popular in enterprise and government settings because it offers self-hosted options, and several Indian IT firms including TCS and Infosys use it internally for on-premise deployments.
| Feature | Git | GitHub | GitLab |
|---|---|---|---|
| Type | Local VCS tool | Cloud hosting platform | Cloud + self-hosted platform |
| Owned by | Open source (Torvalds) | Microsoft | GitLab Inc. |
| Works offline | Yes | No | No (cloud version) |
| Pull requests | Not applicable | Yes | Yes (called Merge Requests) |
| CI/CD built in | No | GitHub Actions | GitLab CI/CD |
| Best for | Local version tracking | Open source, portfolios | Enterprise, private teams |
Essential Git and GitHub Commands Every Beginner Must Know
Git and GitHub for beginners does not require memorising 50 commands. You need to understand about 12 and know when to use them. Here is the complete beginner workflow from creating a project to pushing it live.
Setting Up Git for the First Time
Before anything else, tell Git who you are. Open your terminal and run these two lines:
- git config –global user.name “Your Name”
- git config –global user.email “you@email.com”
This information gets attached to every commit you make. Recruiters and open-source maintainers see it, so use your real name.
Starting a Repository
A repository (repo) is just a folder that Git is tracking. You start one with git init inside your project folder. If you are working from an existing GitHub project, use git clone <url> to download the whole thing including its history.
The Core Daily Workflow
Most of your Git life looks like this loop: make changes, stage them, commit them, push them. Four commands, repeated every day.
- git status shows which files have changed since your last commit
- git add . stages all changed files (replace the dot with a filename to stage one file)
- git commit -m “your message” saves a snapshot with a description
- git push origin main uploads your commits to GitHub
Write commit messages like you are telling a colleague what you did. “Fixed login bug on mobile” is useful. “update” is not.
Branching and Merging
A branch is a parallel version of your project. You create one to work on a new feature without touching the stable main code. When you are done, you merge it back.
- git branch feature-login creates a new branch
- git checkout feature-login switches to it (or use git switch feature-login in newer Git versions)
- git merge feature-login merges it into your current branch
- git branch -d feature-login deletes the branch after merging
Merge vs rebase is a debate you will hit eventually. Merge preserves the full history of both branches. Rebase rewrites history to look like a single linear line. For beginners, stick with merge. Rebase is powerful but can cause real damage if you use it on shared branches without knowing what you are doing.
Pulling Changes from GitHub
When a teammate pushes code, you need to bring it down to your machine. git pull origin main does exactly that. It fetches the latest commits and merges them into your local branch automatically.
If you only want to download without merging, use git fetch first and review the changes before integrating them.
Quick Git Command Reference
| Command | What It Does | When to Use It |
|---|---|---|
| git init | Initialises a new local repo | Starting a brand new project |
| git clone <url> | Copies a remote repo locally | Working on an existing project |
| git status | Shows changed/staged files | Before every add or commit |
| git add . | Stages all changes | After editing files |
| git commit -m “” | Saves a snapshot | After staging |
| git push origin main | Uploads commits to GitHub | After committing |
| git pull origin main | Downloads and merges remote changes | Before starting new work |
| git branch <name> | Creates a new branch | Starting a feature |
| git checkout <branch> | Switches branches | Moving between features |
| git merge <branch> | Merges a branch into current | Finishing a feature |
| git log –oneline | Shows compact commit history | Reviewing past changes |
| git diff | Shows line-by-line changes | Before committing |
If you are building hands-on projects alongside these commands, check out 3.0 University’s guide to cybersecurity projects for students. Every one of those projects benefits from proper version control from day one.
Pushing Your First Project to GitHub and Making a Pull Request
This is the full walkthrough for git and github for beginners. By the end of this section, you will have a real project on GitHub and understand what a pull request actually is.
Step 1: Create a Repository on GitHub
Log into GitHub, click the green “New” button, give your repo a name (no spaces, use hyphens), and choose public or private. Do not initialise with a README if you already have local files. Click “Create repository.”
Step 2: Connect Your Local Project to GitHub
Inside your local project folder, run these commands in order:
- git init
- git add .
- git commit -m “first commit”
- git remote add origin https://github.com/yourusername/your-repo.git
- git push -u origin main
The -u flag sets the upstream, meaning future pushes only need git push. Refresh your GitHub page. Your files are live.
Step 3: Make Your First Pull Request
A pull request (PR) is a formal request to merge your branch into another branch, usually main. It is how open-source projects review contributions before accepting them. It is also how professional teams at companies like Flipkart, PhonePe, and Swiggy review code before it ships.
To make one: create a branch, make changes, push that branch to GitHub with git push origin feature-branch, then click “Compare and pull request” on GitHub. Add a description of what you changed and why, then submit it. The repo owner reviews and merges or requests changes.
Your GitHub Profile Is Your Developer Resume
GitHub had over 100 million registered developers and more than 420 million repositories as of early 2024, according to GitHub’s own published figures. That scale means recruiters have made it a standard screening tool.
At Indian tech companies and startups, engineering managers regularly check GitHub profiles before interviews. A profile with consistent commits, clear README files, and real projects signals someone who actually writes code, not just someone who claims to. Green contribution squares matter. Start filling them in now.
If you are also working on data projects, 3.0 University’s collection of data analytics projects gives you ready-made material to version-control and display on your profile.
How to Contribute to Open Source with Git and GitHub
Open-source contribution sounds intimidating. It is not, once you understand the workflow. The standard process is called “fork and pull request,” and it follows the same five steps every time.
The Fork and Pull Request Workflow
- Fork the repository by clicking Fork on GitHub to create your own copy of someone else’s project.
- Clone your fork using git clone <your-fork-url> to get it on your machine.
- Create a branch and never work directly on main. Use git checkout -b fix-typo or similar.
- Make your changes and commit following the project’s contribution guidelines, usually in a CONTRIBUTING.md file.
- Push and open a pull request by pushing your branch, going to the original repo on GitHub, and opening a PR from your fork.
Good first contributions for beginners include fixing documentation typos, improving README files, translating content, or adding missing test cases. Projects tagged “good first issue” on GitHub are specifically maintained for new contributors. Search that label on any large repo and you will find approachable tasks.
Why It Matters Beyond the Code
Contributing to open source builds real-world collaboration skills, gets your name into codebases used by thousands of people, and demonstrates initiative that a college GPA cannot show. Indian developers have made significant contributions to projects like NumPy, Django, and the Linux kernel. There is no gate. You just have to start.
Git and GitHub for beginners is not just a technical skill; it is a career asset. The top skills every college student must learn before graduation consistently include version control alongside communication, data literacy, and problem-solving. Start your GitHub profile now, not after your first job.
According to the 2023 JetBrains Developer Ecosystem Survey, 71% of professional developers work on teams of 2 to 12 people. Every single one of those teams uses some form of version control, and Git dominates. Knowing git and github for beginners before you join a team means you are productive from week one, not week four.
Pick one real project this week. Initialise a Git repo, push it to GitHub, and write a proper README. That is the whole starting point. Everything else in this guide builds from that one action.
Frequently Asked Questions
What is the difference between Git and GitHub?
Git is a version control system installed on your local computer that tracks changes to your code. GitHub is a cloud-based platform that hosts Git repositories online so teams can collaborate. You use Git to commit and branch locally, then push to GitHub to share. They work together but are completely separate products.
Which Git commands should beginners learn first?
Start with these ten: git init, git clone, git status, git add, git commit, git push, git pull, git branch, git checkout, and git merge. These cover roughly 90% of daily Git work. Master these before touching rebase, stash, or cherry-pick.
How do I push code to GitHub?
First, connect your local repo to GitHub using git remote add origin <url>. Then stage your files with git add ., commit with git commit -m “message”, and upload with git push origin main. After the first push with the -u flag, you only need to type git push each time.
Why is version control important?
Version control lets you track every change, revert mistakes, and work in parallel with teammates without overwriting each other’s code. It is the safety net that makes professional software development possible. Without it, debugging a broken change across a large codebase becomes a manual, error-prone process that wastes hours.
How do I contribute to open source?
Fork the target repository on GitHub, clone your fork locally, create a new branch for your change, make and commit your edits, then push the branch and open a pull request against the original repo. Search for issues labelled “good first issue” to find beginner-friendly tasks. Read the project’s CONTRIBUTING.md file before you start.
Last updated: July 2026. Reviewed by the 3University editorial team.


