DevOps · Git Learning Plan
Git and GitHub for Beginners: Where to Start in 2026
Quick summary — git for beginners
Beginners should start Git and GitHub in this order: install and configure Git, practise commits and history alone on a small project, then connect to GitHub to push code and build a profile, and finally learn branches and pull requests for teamwork. Two to three weeks of short daily practice is enough to feel comfortable.
In this guide you will learn:
- Setup and first repository — configuring Git correctly.
- Solo practice — commits, history and safe undo.
- Moving to GitHub — push, README and profile.
- A two-week practice plan — daily tasks.
- Common traps — and how to avoid them.
SECTION 01Setup and your first repository
Spend your first session on setup only. Correct configuration prevents confusing problems later, like commits showing the wrong name or GitHub not linking them to your profile.
| Task | Command | Why | Check |
|---|---|---|---|
| Install Git | From git-scm.com or your package manager | Gives you the git command | git --version |
| Set your name | git config --global user.name | Labels your commits | git config user.name |
| Set your email | git config --global user.email | Links commits to GitHub | Use your GitHub email |
| Default branch | git config --global init.defaultBranch main | Matches GitHub's default | New repos use main |
git --version
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main
git config --list --global
mkdir my-first-repo && cd my-first-repo
git init
echo "# My first repo" > README.md
git status
git add README.md
git commit -m "Add README"
git log --oneline
SECTION 02Solo practice: commits, history and safe undo
Before teamwork, get comfortable alone. The goal is simple habits: small commits, clear messages, and knowing how to undo mistakes without panic. Practise on a project you care about so the commits feel meaningful.
| Situation | Command | Effect | Safe? |
|---|---|---|---|
| See what changed | git diff | Shows unstaged changes | Yes, read-only |
| Discard edits in a file | git restore file.txt | Back to last commit | Loses those edits |
| Unstage a file | git restore --staged file.txt | Keeps edits, removes from staging | Yes |
| Undo a pushed commit | git revert <hash> | New commit that reverses it | Yes, history kept |
# The loop you will repeat thousands of times
git status # what changed?
git diff # see the exact lines
git add notes.md # stage what you want
git commit -m "Add notes on loops"
git log --oneline -5 # check history
git restore notes.md # throw away edits since last commit
git restore --staged notes.md # unstage but keep edits
git commit --amend -m "Better message" # fix last commit (before pushing)
git revert a1b2c3d # safely undo a commit already pushed
SECTION 03Moving to GitHub
GitHub hosts your repositories online, backs them up and shows your work to others. Connect it only after the local basics feel normal, so you can tell Git problems apart from GitHub problems.
| Step | Action | Command or place | Result |
|---|---|---|---|
| Create a repo | New repository on github.com | Empty repo, no README | Remote URL ready |
| Authenticate | SSH key or GitHub CLI login | ssh-keygen / gh auth login | Push without passwords |
| Connect and push | Add remote, push main | git remote add origin ... | Code visible online |
| Polish profile | Pin repos, write READMEs | GitHub profile settings | Recruiters see your best work |
git remote add origin git@github.com:yourname/my-first-repo.git
git push -u origin main
# later pushes:
git push
# get changes made on GitHub:
git pull
ssh-keygen -t ed25519 -C "you@example.com"
# press Enter to accept the default file, set a passphrase
cat ~/.ssh/id_ed25519.pub
# copy this public key to GitHub: Settings > SSH and GPG keys
ssh -T git@github.com
SECTION 04A two-week practice plan
Spend 30 to 45 minutes a day. By the end you will have a real repository, a GitHub profile and confidence with daily commands. For a related walkthrough, see Why DevOps Engineers Should Learn Kubernetes.
Week one (local Git)
Day 1 Install and configure, first repo
Day 2 10 small commits on a notes project
Day 3 git diff, git log, git show practice
Day 4 Undo practice: restore, amend
Day 5 Create a .gitignore
Day 6 Branch: git switch -c feature, merge back
Day 7 Review: explain each command in your own words
Week two (GitHub)
Day 8 Create GitHub account, SSH key
Day 9 Push your notes repo, write a README
Day 10 Edit a file on GitHub, git pull locally
Day 11 Branch, push, open a pull request to yourself
Day 12 Create and resolve a merge conflict on purpose
Day 13 Fork a beginner-friendly repo, read its CONTRIBUTING file
Day 14 Pin your repo, update your profile README
Checkpoint: can you do these without notes?
[ ] Commit only some changed files
[ ] Find when a line was added (git log -p)
[ ] Undo a pushed commit safely (git revert)
[ ] Push a new branch and open a PR
[ ] Resolve a simple merge conflict
SECTION 05Common beginner traps and how to avoid them
Most Git pain comes from a handful of avoidable mistakes. Knowing them in advance saves hours of confusion and a few lost files. You may also find Pandas Skills for DevOps Engineer Jobs and Why Python Developers Should Learn Kubernetes useful.
- Committing secrets — add .env and key files to .gitignore before your first commit.
- Giant commits — commit small logical changes so history stays useful.
- Working only on main — use branches for anything experimental.
- Fear of conflicts — practise one on purpose; they are just choices between versions.
- Copy-pasting commands blindly — read what reset, force-push and clean do before running them.
SECTION 06Interview Q&A — git for beginners
Q1What is the difference between Git and GitHub?
Git is a version control tool that runs locally. GitHub is an online platform that hosts Git repositories and adds collaboration features.
Q2What is the staging area?
A middle step where you choose exactly which changes go into the next commit, using git add.
Q3What is the difference between git revert and git reset?
revert adds a new commit that undoes an earlier one, keeping history. reset moves the branch pointer and can rewrite history.
Q4What is a merge conflict?
When Git cannot automatically combine changes because the same lines were changed differently on two branches.
Q5Why use branches?
To work on features or fixes separately without disturbing the main code until the work is ready and reviewed.
SECTION 07Test yourself — git for beginners quiz
Five questions. No sign-up.
0 / 5Pick an answer to see why it is right or wrong.
SECTION 08Frequently asked questions
Where should a beginner start with Git and GitHub?
Install and configure Git, practise commits locally on a small project, then push to GitHub and learn branches and pull requests.
How long does it take to learn Git basics?
Two to three weeks of short daily practice is enough to be comfortable with everyday commands.
Do I need to know coding to use Git?
No. Git works with any files, so you can practise with notes or documents before coding.
Is GitHub free for beginners?
Yes, GitHub offers free accounts with public and private repositories for individuals.
Should I learn Git commands or use a GUI?
Learn the core commands first so you understand what happens; GUIs and editor integrations are fine to use afterwards.
SECTION 09Related reads
Classroom & online · Noida
Start your DevOps journey with Git
Our DevOps Training Course begins with Linux, Git and GitHub before moving into CI/CD, containers and cloud — with hands-on labs every step.
Talk to a counsellor for current fees- Git and GitHub from zero
- Linux and scripting
- CI/CD pipelines
- Weekday & weekend batches