Loading...
+880 1736 699819 Mon - Sat: 9:00 AM - 8:00 PM
Follow us:
Home Blog Article
Blog

Git Tutorial for Beginners to Advanced – Complete Step-by-Step Guide

Git Tutorial for Beginners to Advanced – Complete Step-by-Step Guide

Git tutorial — from BASIC to ADVANCED, explained step-by-step with real-world examples. No rush, no jargon overload. 

Check installation

git --version

Configure Git

git config --global user.name "Your Name"
git config --global user.email "your@email.com"

Initialize Git

git init

Check status

git status

Git File Lifecycle

Untracked → Staged → Committed

Add & Commit

git add file.txt
git add .   # add everything

Commit changes

git commit -m "Initial commit"

View History

git log

git log --oneline

Git Ignore

node_modules/
.env
vendor/

GitHub - Remote Repository

Add remote

git remote add origin https://github.com/username/repo.git

Push code

git branch -M main
git push -u origin main

Clone repository

git clone https://github.com/username/repo.git

Create branch

git branch feature-login

Switch branch

git checkout feature-login

OR

git switch feature-login

Create & switch

git checkout -b feature-login

Merge Branches

git checkout main
git merge feature-login

Merge Conflicts

git add .
git commit -m "Resolved merge conflict"

Unstage file

git reset file.txt

Undo last commit

git reset --soft HEAD~1

Discard changes

git checkout -- file.txt

Stashing

git stash
git stash pop

Advanced Git Commands

Rebase (Clean History)

git rebase main

Cherry-pick

git cherry-pick commit_id

Reset vs Revert

git revert commit_id

Tags (Releases)

git tag v1.0
git push origin v1.0

Professional Workflow

git pull
git checkout -b feature-api
# code
git add .
git commit -m "API integration"
git push origin feature-api

Tags: Blog
Share this post

Encoderbase Team

Author

Articles and insights from the Encoderbase editorial team covering web development, software engineering, and digital solutions.

Enjoyed this article?

Get more articles like this delivered to your inbox — no spam, unsubscribe any time.

Link copied to clipboard!